@supermousejs/states 2.1.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,59 +1,82 @@
1
- # @supermousejs/states
2
-
3
- ## 2.1.0
4
-
5
- ### Minor Changes
6
-
7
- - 0a1652d: fixed build architecture and updated plugin metadata
8
-
9
- ### Patch Changes
10
-
11
- - Updated dependencies [0a1652d]
12
- - @supermousejs/utils@2.1.0
13
-
14
- ## 2.0.4
15
-
16
- ### Patch Changes
17
-
18
- - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
19
- - Updated dependencies [993dc67]
20
- - @supermousejs/utils@2.0.4
21
- - @supermousejs/core@2.0.4
22
-
23
- ## 2.0.3
24
-
25
- ### Patch Changes
26
-
27
- - Updated dependencies
28
- - @supermousejs/core@2.0.3
29
- - @supermousejs/utils@2.0.3
30
-
31
- ## 2.0.2
32
-
33
- ### Patch Changes
34
-
35
- - ae219a0: Update READMEs with correct link to documentation
36
- - Updated dependencies [ae219a0]
37
- - @supermousejs/utils@2.0.2
38
- - @supermousejs/core@2.0.2
39
-
40
- ## 2.0.1
41
-
42
- ### Patch Changes
43
-
44
- - Add minimal README.md files to packages
45
- - Updated dependencies
46
- - @supermousejs/utils@2.0.1
47
- - @supermousejs/core@2.0.1
48
-
49
- ## 2.0.0
50
-
51
- ### Major Changes
52
-
53
- - Initial v2.0.0 release
54
-
55
- ### Patch Changes
56
-
57
- - Updated dependencies
58
- - @supermousejs/utils@2.0.0
59
- - @supermousejs/core@2.0.0
1
+ # @supermousejs/states
2
+
3
+ ## 2.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 6d70c18: remove legacy package and update supermouse domain in readme
8
+ - 14fb5b6: Updated tsconfig to be reference-compliant with core, utils and zoetrope when required
9
+ - Updated dependencies [6d70c18]
10
+ - Updated dependencies [2590af3]
11
+ - Updated dependencies [14fb5b6]
12
+ - Updated dependencies [9fe1a7b]
13
+ - Updated dependencies [9fa6ece]
14
+ - @supermousejs/core@2.1.0
15
+ - @supermousejs/utils@2.2.0
16
+
17
+ ## 2.1.1
18
+
19
+ ### Patch Changes
20
+
21
+ - 67f771b: Add relevant npm metadata to package.json file
22
+ - Updated dependencies [67f771b]
23
+ - @supermousejs/utils@2.1.1
24
+ - @supermousejs/core@2.0.5
25
+
26
+ ## 2.1.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 0a1652d: fixed build architecture and updated plugin metadata
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [0a1652d]
35
+ - @supermousejs/utils@2.1.0
36
+
37
+ ## 2.0.4
38
+
39
+ ### Patch Changes
40
+
41
+ - 993dc67: Updated supemousejs packages with proper author, license and url descriptors to repo
42
+ - Updated dependencies [993dc67]
43
+ - @supermousejs/utils@2.0.4
44
+ - @supermousejs/core@2.0.4
45
+
46
+ ## 2.0.3
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies
51
+ - @supermousejs/core@2.0.3
52
+ - @supermousejs/utils@2.0.3
53
+
54
+ ## 2.0.2
55
+
56
+ ### Patch Changes
57
+
58
+ - ae219a0: Update READMEs with correct link to documentation
59
+ - Updated dependencies [ae219a0]
60
+ - @supermousejs/utils@2.0.2
61
+ - @supermousejs/core@2.0.2
62
+
63
+ ## 2.0.1
64
+
65
+ ### Patch Changes
66
+
67
+ - Add minimal README.md files to packages
68
+ - Updated dependencies
69
+ - @supermousejs/utils@2.0.1
70
+ - @supermousejs/core@2.0.1
71
+
72
+ ## 2.0.0
73
+
74
+ ### Major Changes
75
+
76
+ - Initial v2.0.0 release
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies
81
+ - @supermousejs/utils@2.0.0
82
+ - @supermousejs/core@2.0.0
package/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Sijibomi Olusunmbola
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sijibomi Olusunmbola
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,44 +1,46 @@
1
-
2
- # @supermousejs/states
3
-
4
- A **Logic Controller** that enables/disables other plugins based on hover attributes.
5
- Useful for creating complex interaction modes (e.g. "View" mode vs "Edit" mode).
6
-
7
- ## Installation
8
-
9
- ```bash
10
- pnpm add @supermousejs/states
11
- ```
12
-
13
- ## Usage
14
-
15
- ```ts
16
- import { Supermouse } from '@supermousejs/core';
17
- import { States } from '@supermousejs/states';
18
-
19
- const app = new Supermouse();
20
-
21
- // Define your plugins normally (names are required)
22
- app.use(Dot({ name: 'dot' }));
23
- app.use(Ring({ name: 'ring' }));
24
- app.use(Text({ name: 'text' }));
25
-
26
- // Configure states
27
- app.use(States({
28
- default: ['dot'], // Plugins active by default
29
- states: {
30
- 'hover': ['dot', 'ring'],
31
- 'info': ['text']
32
- }
33
- }));
34
- ```
35
-
36
- **HTML:**
37
- ```html
38
- <div data-supermouse-state="hover">Hover me</div>
39
- <div data-supermouse-state="info" data-supermouse-text="Hello">Info</div>
40
- ```
41
-
42
- ## Documentation
43
-
44
- Full documentation and interactive playground available at [supermouse](https://supermouse.vercel.app) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
1
+ # @supermousejs/states
2
+
3
+ A **Logic Controller** that enables/disables other plugins based on hover attributes.
4
+ Useful for creating complex interaction modes (e.g. "View" mode vs "Edit" mode).
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pnpm add @supermousejs/states
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```ts
15
+ import { Supermouse } from "@supermousejs/core";
16
+ import { States } from "@supermousejs/states";
17
+
18
+ const app = new Supermouse();
19
+
20
+ // Define your plugins normally (names are required)
21
+ app.use(Dot({ name: "dot" }));
22
+ app.use(Ring({ name: "ring" }));
23
+ app.use(Text({ name: "text" }));
24
+
25
+ // Configure states
26
+ app.use(
27
+ States({
28
+ default: ["dot"], // Plugins active by default
29
+ states: {
30
+ hover: ["dot", "ring"],
31
+ info: ["text"]
32
+ }
33
+ })
34
+ );
35
+ ```
36
+
37
+ **HTML:**
38
+
39
+ ```html
40
+ <div data-supermouse-state="hover">Hover me</div>
41
+ <div data-supermouse-state="info" data-supermouse-text="Hello">Info</div>
42
+ ```
43
+
44
+ ## Documentation
45
+
46
+ Full documentation and interactive playground available at [supermouse](https://supermouse.js.org) or [check out the repo](https://github.com/Whitestar14/supermouse-js).
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SupermousePlugin } from '../../core/src/index.ts';
1
+ import { SupermousePlugin } from '../../core/src';
2
2
 
3
3
  export declare const States: (options: StatesOptions) => SupermousePlugin;
4
4
 
package/dist/index.mjs CHANGED
@@ -5,33 +5,36 @@ const v = (a) => {
5
5
  e.forEach((l) => i.add(l));
6
6
  });
7
7
  let c = "default", d = !1;
8
- return f({
9
- name: "states",
10
- // High priority: Run BEFORE visual plugins so they know if they are enabled/disabled this frame
11
- priority: -999,
12
- install(e) {
13
- e.registerHoverTarget(`[${r}]`);
14
- },
15
- update(e) {
16
- d || (i.forEach((t) => {
17
- u.has(t) || e.disablePlugin(t);
18
- }), u.forEach((t) => {
19
- e.enablePlugin(t);
20
- }), d = !0);
21
- const l = e.state.hoverTarget;
22
- let s = "default";
23
- if (l && l.hasAttribute(r)) {
24
- const t = l.getAttribute(r);
25
- t && a.states[t] && (s = t);
26
- }
27
- if (s !== c) {
28
- const t = s === "default" ? a.default : a.states[s];
29
- (/* @__PURE__ */ new Set([...u, ...i])).forEach((n) => {
30
- t.includes(n) ? e.enablePlugin(n) : e.disablePlugin(n);
31
- }), c = s;
8
+ return f(
9
+ {
10
+ name: "states",
11
+ // High priority: Run BEFORE visual plugins so they know if they are enabled/disabled this frame
12
+ priority: -999,
13
+ install(e) {
14
+ e.registerHoverTarget(`[${r}]`);
15
+ },
16
+ update(e) {
17
+ d || (i.forEach((t) => {
18
+ u.has(t) || e.disablePlugin(t);
19
+ }), u.forEach((t) => {
20
+ e.enablePlugin(t);
21
+ }), d = !0);
22
+ const l = e.state.hoverTarget;
23
+ let s = "default";
24
+ if (l && l.hasAttribute(r)) {
25
+ const t = l.getAttribute(r);
26
+ t && a.states[t] && (s = t);
27
+ }
28
+ if (s !== c) {
29
+ const t = s === "default" ? a.default : a.states[s];
30
+ (/* @__PURE__ */ new Set([...u, ...i])).forEach((n) => {
31
+ t.includes(n) ? e.enablePlugin(n) : e.disablePlugin(n);
32
+ }), c = s;
33
+ }
32
34
  }
33
- }
34
- }, a);
35
+ },
36
+ a
37
+ );
35
38
  };
36
39
  export {
37
40
  v as States
package/meta.json CHANGED
@@ -1,14 +1,31 @@
1
-
2
- {
3
- "id": "states",
4
- "name": "States",
5
- "package": "@supermousejs/states",
6
- "description": "Logic controller that enables/disables other plugins based on hover attributes.",
7
- "code": "app.use(States({ default: ['dot'], states: { 'hover': ['ring'] } }));",
8
- "icon": "context",
9
- "options": [
10
- { "name": "default", "type": "string[]", "default": "[]", "description": "List of plugin names active by default.", "reactive": false },
11
- { "name": "states", "type": "Record<string, string[]>", "default": "{}", "description": "Map of state names to lists of active plugins.", "reactive": false },
12
- { "name": "attribute", "type": "string", "default": "'data-supermouse-state'", "description": "DOM attribute to trigger state changes.", "reactive": false }
13
- ]
14
- }
1
+ {
2
+ "id": "states",
3
+ "name": "States",
4
+ "package": "@supermousejs/states",
5
+ "description": "Logic controller that enables/disables other plugins based on hover attributes.",
6
+ "code": "app.use(States({ default: ['dot'], states: { 'hover': ['ring'] } }));",
7
+ "icon": "context",
8
+ "options": [
9
+ {
10
+ "name": "default",
11
+ "type": "string[]",
12
+ "default": "[]",
13
+ "description": "List of plugin names active by default.",
14
+ "reactive": false
15
+ },
16
+ {
17
+ "name": "states",
18
+ "type": "Record<string, string[]>",
19
+ "default": "{}",
20
+ "description": "Map of state names to lists of active plugins.",
21
+ "reactive": false
22
+ },
23
+ {
24
+ "name": "attribute",
25
+ "type": "string",
26
+ "default": "'data-supermouse-state'",
27
+ "description": "DOM attribute to trigger state changes.",
28
+ "reactive": false
29
+ }
30
+ ]
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supermousejs/states",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "main": "dist/index.umd.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -8,14 +8,23 @@
8
8
  "url": "https://github.com/Whitestar14/supermouse-js",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@supermousejs/utils": "2.1.0"
11
+ "@supermousejs/utils": "2.2.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@supermousejs/core": "2.0.4"
14
+ "@supermousejs/core": "2.1.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@supermousejs/core": "2.0.4"
17
+ "@supermousejs/core": "2.1.0"
18
18
  },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/Whitestar14/supermouse-js.git",
22
+ "directory": "packages/core"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/Whitestar14/supermouse-js/issues"
26
+ },
27
+ "homepage": "https://github.com/Whitestar14/supermouse-js/tree/main/packages/states#readme",
19
28
  "exports": {
20
29
  ".": {
21
30
  "types": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,97 +1,99 @@
1
- import { definePlugin } from '@supermousejs/utils';
2
-
3
- export interface StatesOptions {
4
- name?: string;
5
- isEnabled?: boolean;
6
- /** The default state (active when nothing else is hovered). */
7
- default: string[];
8
- /** Map of state names to lists of plugin names to enable. */
9
- states: Record<string, string[]>;
10
- /** CSS selector attribute to trigger state change. Default 'data-supermouse-state'. */
11
- attribute?: string;
12
- }
13
-
14
- export const States = (options: StatesOptions) => {
15
- const attr = options.attribute || 'data-supermouse-state';
16
-
17
- // Cache the relationships for fast lookups
18
- const allManagedPlugins = new Set<string>(); // All plugins mentioned in 'states'
19
- const defaultPlugins = new Set(options.default);
20
-
21
- // Populate the set of managed plugins (excluding defaults for now)
22
- Object.values(options.states).forEach(list => {
23
- list.forEach(p => allManagedPlugins.add(p));
24
- });
25
-
26
- let currentState = 'default';
27
- let hasInitialized = false;
28
-
29
- return definePlugin({
30
- name: 'states',
31
- // High priority: Run BEFORE visual plugins so they know if they are enabled/disabled this frame
32
- priority: -999,
33
-
34
- install(app) {
35
- // Register the trigger attribute
36
- app.registerHoverTarget(`[${attr}]`);
37
- },
38
-
39
- update(app) {
40
- // --- INITIALIZATION STEP ---
41
- // We do this in the first update tick to ensure all other plugins
42
- // have been registered via .use(), regardless of order.
43
- if (!hasInitialized) {
44
- // 1. Disable all "Special State" plugins initially
45
- allManagedPlugins.forEach(name => {
46
- if (!defaultPlugins.has(name)) {
47
- app.disablePlugin(name);
48
- }
49
- });
50
-
51
- // 2. Ensure default plugins are enabled
52
- defaultPlugins.forEach(name => {
53
- app.enablePlugin(name);
54
- });
55
-
56
- hasInitialized = true;
57
- }
58
-
59
- // --- STANDARD LOGIC ---
60
- const target = app.state.hoverTarget;
61
- let nextState = 'default';
62
-
63
- // 1. Determine Desired State
64
- if (target && target.hasAttribute(attr)) {
65
- const val = target.getAttribute(attr);
66
- if (val && options.states[val]) {
67
- nextState = val;
68
- }
69
- }
70
-
71
- // 2. Switch State (Only if changed)
72
- if (nextState !== currentState) {
73
-
74
- // A. Determine which plugins should be active
75
- const activePlugins = nextState === 'default'
76
- ? options.default
77
- : options.states[nextState];
78
-
79
- // B. Apply changes
80
- // Note: We combine default + managed to ensure we cover everyone involved
81
- const involved = new Set([...defaultPlugins, ...allManagedPlugins]);
82
-
83
- involved.forEach(pluginName => {
84
- const shouldBeActive = activePlugins.includes(pluginName);
85
-
86
- if (shouldBeActive) {
87
- app.enablePlugin(pluginName);
88
- } else {
89
- app.disablePlugin(pluginName);
90
- }
91
- });
92
-
93
- currentState = nextState;
94
- }
95
- }
96
- }, options);
97
- };
1
+ import type { Supermouse } from "@supermousejs/core";
2
+ import { definePlugin } from "@supermousejs/utils";
3
+
4
+ export interface StatesOptions {
5
+ name?: string;
6
+ isEnabled?: boolean;
7
+ /** The default state (active when nothing else is hovered). */
8
+ default: string[];
9
+ /** Map of state names to lists of plugin names to enable. */
10
+ states: Record<string, string[]>;
11
+ /** CSS selector attribute to trigger state change. Default 'data-supermouse-state'. */
12
+ attribute?: string;
13
+ }
14
+
15
+ export const States = (options: StatesOptions) => {
16
+ const attr = options.attribute || "data-supermouse-state";
17
+
18
+ // Cache the relationships for fast lookups
19
+ const allManagedPlugins = new Set<string>(); // All plugins mentioned in 'states'
20
+ const defaultPlugins = new Set(options.default);
21
+
22
+ // Populate the set of managed plugins (excluding defaults for now)
23
+ Object.values(options.states).forEach((list) => {
24
+ list.forEach((p) => allManagedPlugins.add(p));
25
+ });
26
+
27
+ let currentState = "default";
28
+ let hasInitialized = false;
29
+
30
+ return definePlugin(
31
+ {
32
+ name: "states",
33
+ // High priority: Run BEFORE visual plugins so they know if they are enabled/disabled this frame
34
+ priority: -999,
35
+
36
+ install(app: Supermouse) {
37
+ // Register the trigger attribute
38
+ app.registerHoverTarget(`[${attr}]`);
39
+ },
40
+
41
+ update(app: Supermouse) {
42
+ // --- INITIALIZATION STEP ---
43
+ // We do this in the first update tick to ensure all other plugins
44
+ // have been registered via .use(), regardless of order.
45
+ if (!hasInitialized) {
46
+ // 1. Disable all "Special State" plugins initially
47
+ allManagedPlugins.forEach((name) => {
48
+ if (!defaultPlugins.has(name)) {
49
+ app.disablePlugin(name);
50
+ }
51
+ });
52
+
53
+ // 2. Ensure default plugins are enabled
54
+ defaultPlugins.forEach((name) => {
55
+ app.enablePlugin(name);
56
+ });
57
+
58
+ hasInitialized = true;
59
+ }
60
+
61
+ // --- STANDARD LOGIC ---
62
+ const target = app.state.hoverTarget;
63
+ let nextState = "default";
64
+
65
+ // 1. Determine Desired State
66
+ if (target && target.hasAttribute(attr)) {
67
+ const val = target.getAttribute(attr);
68
+ if (val && options.states[val]) {
69
+ nextState = val;
70
+ }
71
+ }
72
+
73
+ // 2. Switch State (Only if changed)
74
+ if (nextState !== currentState) {
75
+ // A. Determine which plugins should be active
76
+ const activePlugins =
77
+ nextState === "default" ? options.default : options.states[nextState];
78
+
79
+ // B. Apply changes
80
+ // Note: We combine default + managed to ensure we cover everyone involved
81
+ const involved = new Set([...defaultPlugins, ...allManagedPlugins]);
82
+
83
+ involved.forEach((pluginName) => {
84
+ const shouldBeActive = activePlugins.includes(pluginName);
85
+
86
+ if (shouldBeActive) {
87
+ app.enablePlugin(pluginName);
88
+ } else {
89
+ app.disablePlugin(pluginName);
90
+ }
91
+ });
92
+
93
+ currentState = nextState;
94
+ }
95
+ }
96
+ },
97
+ options
98
+ );
99
+ };
package/tsconfig.json CHANGED
@@ -1,18 +1,4 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
3
- "include": [
4
- "src"
5
- ],
6
- "compilerOptions": {
7
- "outDir": "dist",
8
- "baseUrl": ".",
9
- "paths": {
10
- "@supermousejs/core": [
11
- "../core/src/index.ts"
12
- ],
13
- "@supermousejs/utils": [
14
- "../utils/src/index.ts"
15
- ]
16
- }
17
- }
18
- }
2
+ "extends": "../../tsconfig.plugin.json",
3
+ "include": ["src"]
4
+ }
package/vite.config.ts CHANGED
@@ -1,22 +1,23 @@
1
- import { defineConfig } from 'vite';
2
- import dts from 'vite-plugin-dts';
3
- import path from 'path';
4
-
5
- export default defineConfig({
6
- build: {
7
- lib: {
8
- entry: path.resolve(__dirname, 'src/index.ts'),
9
- name: 'SupermouseStates',
10
- fileName: (format) => format === 'es' ? 'index.mjs' : 'index.umd.js',
11
- },
12
- rollupOptions: {
13
- external: ['@supermousejs/core', '@supermousejs/utils'],
14
- output: {
15
- globals: {
16
- '@supermousejs/core': 'SupermouseCore'
17
- , '@supermousejs/utils': 'SupermouseUtils'}
18
- }
19
- }
20
- },
21
- plugins: [dts({ rollupTypes: true })]
22
- });
1
+ import { defineConfig } from "vite";
2
+ import dts from "vite-plugin-dts";
3
+ import path from "path";
4
+
5
+ export default defineConfig({
6
+ build: {
7
+ lib: {
8
+ entry: path.resolve(__dirname, "src/index.ts"),
9
+ name: "SupermouseStates",
10
+ fileName: (format) => (format === "es" ? "index.mjs" : "index.umd.js")
11
+ },
12
+ rollupOptions: {
13
+ external: ["@supermousejs/core", "@supermousejs/utils"],
14
+ output: {
15
+ globals: {
16
+ "@supermousejs/core": "SupermouseCore",
17
+ "@supermousejs/utils": "SupermouseUtils"
18
+ }
19
+ }
20
+ }
21
+ },
22
+ plugins: [dts({ rollupTypes: true })]
23
+ });