@defra/interactive-map 0.0.5-alpha → 0.0.6-alpha
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/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/src/utils/spatial.js +4 -0
- package/plugins/interact/src/utils/spatial.test.js +8 -1
- package/src/App/store/AppProvider.jsx +18 -18
- package/src/App/store/appActionsMap.js +3 -0
- package/src/App/store/appActionsMap.test.js +5 -0
- package/src/scss/settings/_colors.scss +1 -1
- package/src/scss/settings/_dimensions.scss +2 -2
- package/src/utils/detectInterfaceType.js +2 -1
|
@@ -44,22 +44,6 @@ export const AppProvider = ({ options, children }) => {
|
|
|
44
44
|
|
|
45
45
|
useMediaQueryDispatch(rawDispatch, options)
|
|
46
46
|
|
|
47
|
-
const handleBreakpointChange = breakpointDetector.subscribe((breakpoint) => {
|
|
48
|
-
dispatch({
|
|
49
|
-
type: 'SET_BREAKPOINT',
|
|
50
|
-
payload: {
|
|
51
|
-
behaviour: options.behaviour,
|
|
52
|
-
breakpoint,
|
|
53
|
-
hybridWidth: options.hybridWidth,
|
|
54
|
-
maxMobileWidth: options.maxMobileWidth
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const handleInterfaceTypeChange = subscribeToInterfaceChanges((newType) => {
|
|
60
|
-
dispatch({ type: 'SET_INTERFACE_TYPE', payload: newType })
|
|
61
|
-
})
|
|
62
|
-
|
|
63
47
|
const handleSetMode = (mode) => {
|
|
64
48
|
dispatch({ type: 'SET_MODE', payload: mode })
|
|
65
49
|
}
|
|
@@ -72,11 +56,27 @@ export const AppProvider = ({ options, children }) => {
|
|
|
72
56
|
eventBus.on(events.APP_SET_MODE, handleSetMode)
|
|
73
57
|
eventBus.on(events.APP_REVERT_MODE, handleRevertMode)
|
|
74
58
|
|
|
59
|
+
const unsubBreakpoint = breakpointDetector.subscribe((breakpoint) => {
|
|
60
|
+
dispatch({
|
|
61
|
+
type: 'SET_BREAKPOINT',
|
|
62
|
+
payload: {
|
|
63
|
+
behaviour: options.behaviour,
|
|
64
|
+
breakpoint,
|
|
65
|
+
hybridWidth: options.hybridWidth,
|
|
66
|
+
maxMobileWidth: options.maxMobileWidth
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const unsubInterface = subscribeToInterfaceChanges((newType) => {
|
|
72
|
+
dispatch({ type: 'SET_INTERFACE_TYPE', payload: newType })
|
|
73
|
+
})
|
|
74
|
+
|
|
75
75
|
return () => {
|
|
76
76
|
eventBus.off(events.APP_SET_MODE, handleSetMode)
|
|
77
77
|
eventBus.off(events.APP_REVERT_MODE, handleRevertMode)
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
unsubBreakpoint()
|
|
79
|
+
unsubInterface()
|
|
80
80
|
}
|
|
81
81
|
}, [])
|
|
82
82
|
|
|
@@ -83,6 +83,11 @@ describe('actionsMap full coverage', () => {
|
|
|
83
83
|
expect(result.interfaceType).toBe('compact')
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
+
test('SET_INTERFACE_TYPE returns same state reference when interfaceType unchanged', () => {
|
|
87
|
+
const result = actionsMap.SET_INTERFACE_TYPE(state, state.interfaceType)
|
|
88
|
+
expect(result).toBe(state)
|
|
89
|
+
})
|
|
90
|
+
|
|
86
91
|
test('OPEN_PANEL adds a panel with props', () => {
|
|
87
92
|
const result = actionsMap.OPEN_PANEL(state, { panelId: 'panel2', props: { foo: 'bar' } })
|
|
88
93
|
expect(result.openPanels.panel2?.props).toEqual({ foo: 'bar' })
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
// Borders and focus
|
|
14
14
|
--app-border-width: 1px;
|
|
15
|
-
--button-border-radius: 4px;
|
|
16
|
-
--panel-border-radius: 8px;
|
|
15
|
+
--button-border-radius: 0px; // 4px;
|
|
16
|
+
--panel-border-radius: 0px; // 8px;
|
|
17
17
|
--focus-border-width: 3px;
|
|
18
18
|
--focus-outline-width: 3px;
|
|
19
19
|
|
|
@@ -33,7 +33,7 @@ function notifyListeners (newType) {
|
|
|
33
33
|
function createInterfaceDetector () {
|
|
34
34
|
const mql = window.matchMedia('(pointer: coarse)')
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// System pointer type changes
|
|
37
37
|
const handleMediaChange = e => {
|
|
38
38
|
notifyListeners(e.matches ? 'touch' : 'mouse')
|
|
39
39
|
}
|
|
@@ -66,6 +66,7 @@ function createInterfaceDetector () {
|
|
|
66
66
|
|
|
67
67
|
function getInterfaceType () {
|
|
68
68
|
if (lastInterfaceType === 'unknown') {
|
|
69
|
+
lastInterfaceType = 'mouse'
|
|
69
70
|
return 'mouse'
|
|
70
71
|
}
|
|
71
72
|
|