@symbo.ls/sync 2.11.437 → 2.11.446
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 +52 -51
- package/Notifications.js +35 -33
- package/index.js +6 -0
- package/package.json +9 -9
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,13 +4,62 @@ 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
|
+
const inspectOnKey = (app, state, 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.Inspector.state.update({ area: false })
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
7
56
|
export const Inspect = {
|
|
8
57
|
props: {
|
|
9
58
|
'.preventSelect': { userSelect: 'none' },
|
|
10
59
|
'!preventSelect': { userSelect: 'auto' }
|
|
11
60
|
},
|
|
12
61
|
|
|
13
|
-
|
|
62
|
+
Inspector: {
|
|
14
63
|
state: {},
|
|
15
64
|
props: (el, s) => ({
|
|
16
65
|
transition: 'all, defaultBezier, X',
|
|
@@ -92,10 +141,11 @@ export const Inspect = {
|
|
|
92
141
|
},
|
|
93
142
|
|
|
94
143
|
on: {
|
|
144
|
+
inspectOnKey,
|
|
95
145
|
mousemove: (ev, e, state) => {
|
|
96
146
|
const el = ev.target.ref
|
|
97
147
|
const component = findComponent(el)
|
|
98
|
-
const focusState = e.
|
|
148
|
+
const focusState = e.Inspector.state
|
|
99
149
|
|
|
100
150
|
if (!component || !state.debugging || !component.__ref) return focusState.update({ area: false })
|
|
101
151
|
|
|
@@ -145,52 +195,3 @@ export const Inspect = {
|
|
|
145
195
|
}
|
|
146
196
|
}
|
|
147
197
|
}
|
|
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
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sync",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.446",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "d042e0c4fc9379b0ca7584f6405cfa2e7c1301d4",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@domql/globals": "
|
|
9
|
-
"@domql/router": "
|
|
10
|
-
"@domql/utils": "
|
|
11
|
-
"@symbo.ls/init": "
|
|
12
|
-
"@symbo.ls/scratch": "
|
|
13
|
-
"@symbo.ls/socket": "
|
|
14
|
-
"@symbo.ls/uikit": "
|
|
8
|
+
"@domql/globals": "^2.5.0",
|
|
9
|
+
"@domql/router": "^2.5.0",
|
|
10
|
+
"@domql/utils": "^2.5.0",
|
|
11
|
+
"@symbo.ls/init": "^2.11.446",
|
|
12
|
+
"@symbo.ls/scratch": "^2.11.446",
|
|
13
|
+
"@symbo.ls/socket": "^2.11.446",
|
|
14
|
+
"@symbo.ls/uikit": "^2.11.446"
|
|
15
15
|
}
|
|
16
16
|
}
|