ywana-core8 0.0.493 → 0.0.496
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/index.cjs +15379 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +19 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +15370 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +15374 -24
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/site/console.js +18 -0
- package/src/site/site.css +19 -1
- package/src/site/site.js +34 -14
- package/src/site/site.test.js +8 -1
package/package.json
CHANGED
package/src/site/site.css
CHANGED
@@ -115,7 +115,25 @@
|
|
115
115
|
grid-area: footer;
|
116
116
|
min-height: 20rem;
|
117
117
|
background-color: rgb(222, 222, 222);
|
118
|
-
color: #
|
118
|
+
color: #000;
|
119
|
+
}
|
120
|
+
|
121
|
+
.site6>.site-console>nav {
|
122
|
+
display: flex;
|
123
|
+
align-items: center;
|
124
|
+
justify-content: flex-end;
|
125
|
+
}
|
126
|
+
|
127
|
+
.site6>.site-console>main {
|
128
|
+
overflow: scroll;
|
129
|
+
max-height: 40vh;
|
130
|
+
display: flex;
|
131
|
+
flex-direction: column-reverse;
|
132
|
+
}
|
133
|
+
|
134
|
+
.site6>.site-console>main>div {
|
135
|
+
padding: 1rem;
|
136
|
+
border-bottom: dotted 1px var(--divider-color);
|
119
137
|
}
|
120
138
|
|
121
139
|
.site6>.site-preview {
|
package/src/site/site.js
CHANGED
@@ -9,35 +9,38 @@ import './site.css'
|
|
9
9
|
|
10
10
|
import { ReactNotifications, Store } from 'react-notifications-component'
|
11
11
|
import 'react-notifications-component/dist/theme.css'
|
12
|
+
import { Console } from './console'
|
12
13
|
|
13
14
|
|
14
15
|
|
15
16
|
/**
|
16
17
|
* Site Provider
|
17
18
|
*/
|
18
|
-
export const SiteProvider = ({ children, siteLang, siteDictionary
|
19
|
-
|
19
|
+
export const SiteProvider = ({ children, siteLang, siteDictionary }) => {
|
20
|
+
|
20
21
|
const [lang, setLang] = useState(siteLang)
|
21
22
|
const [dictionary, setDictionary] = useState(siteDictionary)
|
22
23
|
const [sideNav, setSideNav] = useState('max')
|
23
24
|
const [showNav, setShowNav] = useState(false)
|
24
25
|
const [info, setInfo] = useState(null)
|
25
|
-
const [
|
26
|
+
const [showConsole, setShowConsole] = useState(true)
|
27
|
+
const [consoleLines, setConsoleLines] = useState([])
|
26
28
|
const [page, setPage] = useState()
|
27
29
|
const [dialog, setDialog] = useState()
|
28
30
|
const [promptDialog, setPromptDialog] = useState()
|
29
31
|
const [preview, setPreview] = useState()
|
30
32
|
const [breadcrumb, setBreadcrumb] = useState()
|
31
33
|
const [focused, setFocused] = useState()
|
32
|
-
|
34
|
+
|
35
|
+
|
33
36
|
const value = {
|
34
|
-
|
37
|
+
|
35
38
|
lang,
|
36
39
|
setLang,
|
37
|
-
|
40
|
+
|
38
41
|
dictionary,
|
39
42
|
setDictionary,
|
40
|
-
|
43
|
+
|
41
44
|
focused,
|
42
45
|
changeFocus: (next) => {
|
43
46
|
if (focused) focused.lose()
|
@@ -47,19 +50,27 @@ export const SiteProvider = ({ children, siteLang, siteDictionary, showConsole }
|
|
47
50
|
if (focused) focused.lose()
|
48
51
|
setFocused(null)
|
49
52
|
},
|
50
|
-
|
53
|
+
|
51
54
|
sideNav,
|
52
55
|
setSideNav,
|
53
56
|
|
54
57
|
showNav,
|
55
58
|
setShowNav,
|
56
|
-
|
59
|
+
|
57
60
|
info,
|
58
61
|
openInfo: (info) => { setInfo(info) },
|
59
62
|
closeInfo: () => { setInfo(null) },
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
|
64
|
+
consoleLines,
|
65
|
+
showConsole,
|
66
|
+
toggleConsole: () => { setShowConsole(!showConsole) },
|
67
|
+
log: (line) => {
|
68
|
+
const next = consoleLines.concat(line)
|
69
|
+
setConsoleLines(next)
|
70
|
+
},
|
71
|
+
clearLog: () => {
|
72
|
+
setConsoleLines([])
|
73
|
+
},
|
63
74
|
|
64
75
|
breadcrumb,
|
65
76
|
setBreadcrumb,
|
@@ -302,16 +313,25 @@ const SitePreview = () => {
|
|
302
313
|
* Site Console
|
303
314
|
*/
|
304
315
|
const SiteConsole = () => {
|
316
|
+
|
305
317
|
const context = useContext(SiteContext)
|
306
|
-
|
318
|
+
|
319
|
+
function clear() {
|
320
|
+
context.clearLog()
|
321
|
+
}
|
322
|
+
|
323
|
+
return context.showConsole ? (
|
307
324
|
<footer className="site-console" >
|
308
325
|
<Header>
|
309
326
|
<Tabs>
|
310
327
|
<Tab label="Console" />
|
311
328
|
</Tabs>
|
312
329
|
</Header>
|
330
|
+
<nav>
|
331
|
+
<Icon icon="clear_all" size="small" clickable action={clear} />
|
332
|
+
</nav>
|
313
333
|
<main>
|
314
|
-
|
334
|
+
{context.consoleLines.map(line => <div>{line}</div>)}
|
315
335
|
</main>
|
316
336
|
</footer>
|
317
337
|
) : ''
|
package/src/site/site.test.js
CHANGED
@@ -97,6 +97,7 @@ const Page2 = (props) => {
|
|
97
97
|
<Button label="CLOSE" action={() => site.closeDialog()} />
|
98
98
|
</Fragment>
|
99
99
|
)
|
100
|
+
|
100
101
|
site.openDialog(
|
101
102
|
<Dialog actions={actions}>
|
102
103
|
<main>
|
@@ -105,12 +106,18 @@ const Page2 = (props) => {
|
|
105
106
|
</Dialog>
|
106
107
|
)
|
107
108
|
}
|
108
|
-
|
109
|
+
|
110
|
+
function write() {
|
111
|
+
site.log("xxx"+new Date())
|
112
|
+
}
|
113
|
+
|
114
|
+
|
109
115
|
return (
|
110
116
|
<Fragment>
|
111
117
|
<header>Page 2</header>
|
112
118
|
<main>
|
113
119
|
<Button label="open Dialog" action={openDialog} />
|
120
|
+
<Button label="Write inConsole" action={write} />
|
114
121
|
</main>
|
115
122
|
<footer>f2</footer>
|
116
123
|
</Fragment>
|