@mantine/spotlight 4.2.2 → 4.2.3
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/cjs/events.js +3 -3
- package/cjs/events.js.map +1 -1
- package/esm/events.js +3 -3
- package/esm/events.js.map +1 -1
- package/package.json +3 -3
package/cjs/events.js
CHANGED
|
@@ -28,15 +28,15 @@ function triggerSpotlightAction(actionId) {
|
|
|
28
28
|
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));
|
|
29
29
|
}
|
|
30
30
|
function registerSpotlightActions(actions) {
|
|
31
|
-
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
31
|
+
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.registerActions, actions));
|
|
32
32
|
}
|
|
33
33
|
function removeSpotlightActions(actionsIds) {
|
|
34
|
-
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
34
|
+
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.removeActions, actionsIds));
|
|
35
35
|
}
|
|
36
36
|
function useSpotlightEvents(ctx) {
|
|
37
37
|
const events = {
|
|
38
38
|
registerActions: (event) => ctx.registerActions(event.detail),
|
|
39
|
-
removeActions: (event) => ctx.
|
|
39
|
+
removeActions: (event) => ctx.removeActions(event.detail),
|
|
40
40
|
triggerAction: (event) => ctx.triggerAction(event.detail),
|
|
41
41
|
open: ctx.openSpotlight,
|
|
42
42
|
close: ctx.closeSpotlight,
|
package/cjs/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { SpotlightContextValue } from './Spotlight.context';\nimport type { SpotlightAction } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const SPOTLIGHT_EVENTS = {\n open: 'mantine:open-spotlight',\n close: 'mantine:close-spotlight',\n toggle: 'mantine:toggle-spotlight',\n triggerAction: 'mantine:trigger-spotlight-action',\n registerActions: 'mantine:register-spotlight-actions',\n removeActions: 'mantine:remove-spotlight-actions',\n} as const;\n\nfunction createEvent(type: ValueOf<typeof SPOTLIGHT_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function openSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.open));\n}\n\nexport function closeSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.close));\n}\n\nexport function toggleSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.toggle));\n}\n\nexport function triggerSpotlightAction(actionId: string) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));\n}\n\nexport function registerSpotlightActions(actions: SpotlightAction[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { SpotlightContextValue } from './Spotlight.context';\nimport type { SpotlightAction } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const SPOTLIGHT_EVENTS = {\n open: 'mantine:open-spotlight',\n close: 'mantine:close-spotlight',\n toggle: 'mantine:toggle-spotlight',\n triggerAction: 'mantine:trigger-spotlight-action',\n registerActions: 'mantine:register-spotlight-actions',\n removeActions: 'mantine:remove-spotlight-actions',\n} as const;\n\nfunction createEvent(type: ValueOf<typeof SPOTLIGHT_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function openSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.open));\n}\n\nexport function closeSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.close));\n}\n\nexport function toggleSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.toggle));\n}\n\nexport function triggerSpotlightAction(actionId: string) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));\n}\n\nexport function registerSpotlightActions(actions: SpotlightAction[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.registerActions, actions));\n}\n\nexport function removeSpotlightActions(actionsIds: string[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.removeActions, actionsIds));\n}\n\nexport function useSpotlightEvents(ctx: SpotlightContextValue) {\n const events = {\n registerActions: (event: any) => ctx.registerActions(event.detail),\n removeActions: (event: any) => ctx.removeActions(event.detail),\n triggerAction: (event: any) => ctx.triggerAction(event.detail),\n open: ctx.openSpotlight,\n close: ctx.closeSpotlight,\n toggle: ctx.toggleSpotlight,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(SPOTLIGHT_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(SPOTLIGHT_EVENTS[event], events[event]);\n });\n };\n }, []);\n}\n"],"names":["useEffect"],"mappings":";;;;;;AACY,MAAC,gBAAgB,GAAG;AAChC,EAAE,IAAI,EAAE,wBAAwB;AAChC,EAAE,KAAK,EAAE,yBAAyB;AAClC,EAAE,MAAM,EAAE,0BAA0B;AACpC,EAAE,aAAa,EAAE,kCAAkC;AACnD,EAAE,eAAe,EAAE,oCAAoC;AACvD,EAAE,aAAa,EAAE,kCAAkC;AACnD,EAAE;AACF,SAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;AACnC,EAAE,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3C,CAAC;AACM,SAAS,aAAa,GAAG;AAChC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AACM,SAAS,cAAc,GAAG;AACjC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC;AACM,SAAS,eAAe,GAAG;AAClC,EAAE,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AAC,CAAC,CAAC;AACtE,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM;AACjB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC7C,QAAQ,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3E,OAAO,CAAC,CAAC;AACT,KAAK,CAAC;AACN,GAAG,EAAE,EAAE,CAAC,CAAC;AACT;;;;;;;;;;;"}
|
package/esm/events.js
CHANGED
|
@@ -24,15 +24,15 @@ function triggerSpotlightAction(actionId) {
|
|
|
24
24
|
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));
|
|
25
25
|
}
|
|
26
26
|
function registerSpotlightActions(actions) {
|
|
27
|
-
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
27
|
+
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.registerActions, actions));
|
|
28
28
|
}
|
|
29
29
|
function removeSpotlightActions(actionsIds) {
|
|
30
|
-
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
30
|
+
window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.removeActions, actionsIds));
|
|
31
31
|
}
|
|
32
32
|
function useSpotlightEvents(ctx) {
|
|
33
33
|
const events = {
|
|
34
34
|
registerActions: (event) => ctx.registerActions(event.detail),
|
|
35
|
-
removeActions: (event) => ctx.
|
|
35
|
+
removeActions: (event) => ctx.removeActions(event.detail),
|
|
36
36
|
triggerAction: (event) => ctx.triggerAction(event.detail),
|
|
37
37
|
open: ctx.openSpotlight,
|
|
38
38
|
close: ctx.closeSpotlight,
|
package/esm/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { SpotlightContextValue } from './Spotlight.context';\nimport type { SpotlightAction } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const SPOTLIGHT_EVENTS = {\n open: 'mantine:open-spotlight',\n close: 'mantine:close-spotlight',\n toggle: 'mantine:toggle-spotlight',\n triggerAction: 'mantine:trigger-spotlight-action',\n registerActions: 'mantine:register-spotlight-actions',\n removeActions: 'mantine:remove-spotlight-actions',\n} as const;\n\nfunction createEvent(type: ValueOf<typeof SPOTLIGHT_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function openSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.open));\n}\n\nexport function closeSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.close));\n}\n\nexport function toggleSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.toggle));\n}\n\nexport function triggerSpotlightAction(actionId: string) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));\n}\n\nexport function registerSpotlightActions(actions: SpotlightAction[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { SpotlightContextValue } from './Spotlight.context';\nimport type { SpotlightAction } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const SPOTLIGHT_EVENTS = {\n open: 'mantine:open-spotlight',\n close: 'mantine:close-spotlight',\n toggle: 'mantine:toggle-spotlight',\n triggerAction: 'mantine:trigger-spotlight-action',\n registerActions: 'mantine:register-spotlight-actions',\n removeActions: 'mantine:remove-spotlight-actions',\n} as const;\n\nfunction createEvent(type: ValueOf<typeof SPOTLIGHT_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function openSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.open));\n}\n\nexport function closeSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.close));\n}\n\nexport function toggleSpotlight() {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.toggle));\n}\n\nexport function triggerSpotlightAction(actionId: string) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.triggerAction, actionId));\n}\n\nexport function registerSpotlightActions(actions: SpotlightAction[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.registerActions, actions));\n}\n\nexport function removeSpotlightActions(actionsIds: string[]) {\n window.dispatchEvent(createEvent(SPOTLIGHT_EVENTS.removeActions, actionsIds));\n}\n\nexport function useSpotlightEvents(ctx: SpotlightContextValue) {\n const events = {\n registerActions: (event: any) => ctx.registerActions(event.detail),\n removeActions: (event: any) => ctx.removeActions(event.detail),\n triggerAction: (event: any) => ctx.triggerAction(event.detail),\n open: ctx.openSpotlight,\n close: ctx.closeSpotlight,\n toggle: ctx.toggleSpotlight,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(SPOTLIGHT_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(SPOTLIGHT_EVENTS[event], events[event]);\n });\n };\n }, []);\n}\n"],"names":[],"mappings":";;AACY,MAAC,gBAAgB,GAAG;AAChC,EAAE,IAAI,EAAE,wBAAwB;AAChC,EAAE,KAAK,EAAE,yBAAyB;AAClC,EAAE,MAAM,EAAE,0BAA0B;AACpC,EAAE,aAAa,EAAE,kCAAkC;AACnD,EAAE,eAAe,EAAE,oCAAoC;AACvD,EAAE,aAAa,EAAE,kCAAkC;AACnD,EAAE;AACF,SAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;AACnC,EAAE,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3C,CAAC;AACM,SAAS,aAAa,GAAG;AAChC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AACM,SAAS,cAAc,GA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AM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC3C,MAAM,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACtE,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM;AACjB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC7C,QAAQ,MAAM,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3E,OAAO,CAAC,CAAC;AACT,KAAK,CAAC;AACN,GAAG,EAAE,EAAE,CAAC,CAAC;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/spotlight",
|
|
3
3
|
"description": "Command center for your application",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.3",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"directory": "src/mantine-spotlight"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@mantine/core": "4.2.
|
|
19
|
-
"@mantine/hooks": "4.2.
|
|
18
|
+
"@mantine/core": "4.2.3",
|
|
19
|
+
"@mantine/hooks": "4.2.3",
|
|
20
20
|
"react": ">=16.8.0",
|
|
21
21
|
"react-dom": ">=16.8.0"
|
|
22
22
|
},
|