@symbo.ls/sync 2.11.437 → 2.11.438
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/DefaultSyncApp.js +2 -1
- package/Inspect.js +49 -49
- package/Notifications.js +35 -33
- package/index.js +6 -0
- package/package.json +1 -1
package/DefaultSyncApp.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { SyncComponent } from './index'
|
|
3
4
|
import { Inspect } from './Inspect'
|
|
4
5
|
import { Notifications } from './Notifications'
|
|
5
6
|
|
|
6
7
|
export const DefaultSyncApp = {
|
|
7
|
-
extend: [Inspect, Notifications]
|
|
8
|
+
extend: [SyncComponent, Inspect, Notifications]
|
|
8
9
|
}
|
package/Inspect.js
CHANGED
|
@@ -4,6 +4,55 @@ import * as smblsUI from '@symbo.ls/uikit'
|
|
|
4
4
|
import { isObject, isString, isArray } from '@domql/utils'
|
|
5
5
|
import { send } from '@symbo.ls/socket/client'
|
|
6
6
|
|
|
7
|
+
function returnStringExtend (extend) {
|
|
8
|
+
return isString(extend) ? extend : isArray(extend) ? extend.find(extItem => isString(extItem)) : ''
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getComponentKey (el) {
|
|
12
|
+
if (!el) return
|
|
13
|
+
const __componentKey = el.__ref.__componentKey
|
|
14
|
+
const extendStr = el.extend && returnStringExtend(el.extend)
|
|
15
|
+
const parentChildExtendStr = el.parent && el.parent.childExtend && returnStringExtend(el.parent.childExtend)
|
|
16
|
+
return (__componentKey || extendStr || parentChildExtendStr || '').split('_')[0].split('.')[0].split('+')[0]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function findComponent (el) {
|
|
20
|
+
if (!el || !el.__ref) return
|
|
21
|
+
const { components, pages, editor } = el.context
|
|
22
|
+
const componentKey = getComponentKey(el)
|
|
23
|
+
if (editor && editor.onInitInspect) {
|
|
24
|
+
const initInspectReturns = editor.onInitInspect(componentKey, el, el.state)
|
|
25
|
+
if (!initInspectReturns) return findComponent(el.parent)
|
|
26
|
+
}
|
|
27
|
+
if (componentKey && (components[componentKey] || pages[componentKey])) {
|
|
28
|
+
return el
|
|
29
|
+
}
|
|
30
|
+
return findComponent(el.parent)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const inspectOnKey = (app, ctx) => {
|
|
34
|
+
const windowOpts = ctx.window || window
|
|
35
|
+
windowOpts.onkeydown = (ev) => {
|
|
36
|
+
if (ev.altKey && ev.shiftKey) {
|
|
37
|
+
app.state.update({ debugging: true, preventSelect: true }, {
|
|
38
|
+
preventUpdate: true,
|
|
39
|
+
preventContentUpdate: true,
|
|
40
|
+
preventRecursive: true
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
windowOpts.onkeyup = (ev) => {
|
|
45
|
+
if (app.state.preventSelect && (!ev.altKey || !ev.shiftKey)) {
|
|
46
|
+
app.state.replace({ debugging: false, preventSelect: false }, {
|
|
47
|
+
preventUpdate: true,
|
|
48
|
+
preventContentUpdate: true,
|
|
49
|
+
preventRecursive: true
|
|
50
|
+
})
|
|
51
|
+
app.focus.state.update({ area: false })
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
7
56
|
export const Inspect = {
|
|
8
57
|
props: {
|
|
9
58
|
'.preventSelect': { userSelect: 'none' },
|
|
@@ -145,52 +194,3 @@ export const Inspect = {
|
|
|
145
194
|
}
|
|
146
195
|
}
|
|
147
196
|
}
|
|
148
|
-
|
|
149
|
-
function returnStringExtend (extend) {
|
|
150
|
-
return isString(extend) ? extend : isArray(extend) ? extend.find(extItem => isString(extItem)) : ''
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function getComponentKey (el) {
|
|
154
|
-
if (!el) return
|
|
155
|
-
const __componentKey = el.__ref.__componentKey
|
|
156
|
-
const extendStr = el.extend && returnStringExtend(el.extend)
|
|
157
|
-
const parentChildExtendStr = el.parent && el.parent.childExtend && returnStringExtend(el.parent.childExtend)
|
|
158
|
-
return (__componentKey || extendStr || parentChildExtendStr || '').split('_')[0].split('.')[0].split('+')[0]
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function findComponent (el) {
|
|
162
|
-
if (!el || !el.__ref) return
|
|
163
|
-
const { components, pages, editor } = el.context
|
|
164
|
-
const componentKey = getComponentKey(el)
|
|
165
|
-
if (editor && editor.onInitInspect) {
|
|
166
|
-
const initInspectReturns = editor.onInitInspect(componentKey, el, el.state)
|
|
167
|
-
if (!initInspectReturns) return findComponent(el.parent)
|
|
168
|
-
}
|
|
169
|
-
if (componentKey && (components[componentKey] || pages[componentKey])) {
|
|
170
|
-
return el
|
|
171
|
-
}
|
|
172
|
-
return findComponent(el.parent)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export const inspectOnKey = (app, ctx) => {
|
|
176
|
-
const windowOpts = ctx.window || window
|
|
177
|
-
windowOpts.onkeydown = (ev) => {
|
|
178
|
-
if (ev.altKey && ev.shiftKey) {
|
|
179
|
-
app.state.update({ debugging: true, preventSelect: true }, {
|
|
180
|
-
preventUpdate: true,
|
|
181
|
-
preventContentUpdate: true,
|
|
182
|
-
preventRecursive: true
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
windowOpts.onkeyup = (ev) => {
|
|
187
|
-
if (app.state.preventSelect && (!ev.altKey || !ev.shiftKey)) {
|
|
188
|
-
app.state.replace({ debugging: false, preventSelect: false }, {
|
|
189
|
-
preventUpdate: true,
|
|
190
|
-
preventContentUpdate: true,
|
|
191
|
-
preventRecursive: true
|
|
192
|
-
})
|
|
193
|
-
app.focus.state.update({ area: false })
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
package/Notifications.js
CHANGED
|
@@ -80,41 +80,43 @@ export const connectedToSymbols = (clients, element, state) => {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const Notifications = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
left: 'A2',
|
|
87
|
-
bottom: 'Z2',
|
|
88
|
-
zIndex: '999'
|
|
83
|
+
export const Notifications = {
|
|
84
|
+
state: {
|
|
85
|
+
notifications: []
|
|
89
86
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
props:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
|
|
88
|
+
Notifications: {
|
|
89
|
+
props: {
|
|
90
|
+
position: 'fixed',
|
|
91
|
+
left: 'A2',
|
|
92
|
+
bottom: 'Z2',
|
|
93
|
+
zIndex: '999'
|
|
94
|
+
},
|
|
95
|
+
childExtend: {
|
|
96
|
+
extend: 'Notification',
|
|
97
|
+
props: ({ state }) => ({
|
|
98
|
+
animationDuration: 'C',
|
|
99
|
+
background: NOTIF_COLORS[state.type || 'success'],
|
|
100
|
+
icon: null,
|
|
101
|
+
Flex: {
|
|
102
|
+
Title: {
|
|
103
|
+
text: '{{ title }}'
|
|
104
|
+
},
|
|
105
|
+
P: {
|
|
106
|
+
text: '{{ title }}'
|
|
107
|
+
}
|
|
100
108
|
},
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
onRender: (e, el, s) => {
|
|
110
|
+
el.setProps({ animation: 'fadeInUp' })
|
|
111
|
+
},
|
|
112
|
+
onClick: (e, el, s) => {
|
|
113
|
+
delete s.notifications[el.key]
|
|
114
|
+
el.setProps({ animation: 'fadeOutDown' })
|
|
115
|
+
if (s.onClose) s.onClose(e, el, s)
|
|
103
116
|
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
},
|
|
111
|
-
$stateCollection: ({ state }) => state.notifications
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export const Sync = {
|
|
115
|
-
notifications: Notifications,
|
|
116
|
-
|
|
117
|
-
state: {
|
|
118
|
-
notifications: []
|
|
117
|
+
}),
|
|
118
|
+
IconText: null
|
|
119
|
+
},
|
|
120
|
+
$stateCollection: ({ state }) => state.notifications
|
|
119
121
|
}
|
|
120
122
|
}
|
package/index.js
CHANGED