uimodal tweak, inspector help modal
This commit is contained in:
parent
b090657b69
commit
2c86691bb8
14 changed files with 148 additions and 188 deletions
|
|
@ -21,15 +21,16 @@ class ColorPicker extends UiWidget {
|
|||
...Rgb.defaults()._props(),
|
||||
type: 'rgb',
|
||||
label: false,
|
||||
width: 250,
|
||||
height: 200,
|
||||
width: 'auto',
|
||||
height: 'auto',
|
||||
alphaStroke: 0,
|
||||
snap: true
|
||||
// height: '100%',
|
||||
snap: true,
|
||||
}, parent: this})
|
||||
this.rgb.container.classList.add('not-editable')
|
||||
|
||||
this.modal = new UiModal({
|
||||
width: 280,
|
||||
height: 280,
|
||||
closable: true,
|
||||
title: '',
|
||||
hide: true,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ module.exports = function UiFilebrowser(options, callback) {
|
|||
previousKbContext = keyboardJS.getContext()
|
||||
|
||||
var popup = new UiModal({
|
||||
height: 360,
|
||||
closable: true,
|
||||
title: locales(save ? 'remotesave_save' : 'remotesave_open'),
|
||||
hide: true
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
var UiWidget = require('./ui-widget'),
|
||||
UiInspectorField = require('./ui-inspector-field'),
|
||||
UiColorPicker = require('./ui-colorpicker'),
|
||||
UiModal = require('./ui-modal'),
|
||||
morph = require('nanomorph'),
|
||||
{widgets, defaults} = require('../widgets/'),
|
||||
{deepCopy} = require('../utils'),
|
||||
html = require('nanohtml')
|
||||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw')
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,6 +21,8 @@ class UiInspector extends UiWidget {
|
|||
|
||||
this.foldedCategories = []
|
||||
|
||||
this.widget = null
|
||||
|
||||
this.container.addEventListener('fast-click', (e)=>{
|
||||
|
||||
if (e.target.classList.contains('category-header')) {
|
||||
|
|
@ -64,6 +68,10 @@ class UiInspector extends UiWidget {
|
|||
this.colorPicker.setValue(node.getAttribute('value'))
|
||||
this.colorPicker.open()
|
||||
|
||||
} else if (node.tagName === 'LABEL') {
|
||||
|
||||
this.help(node.textContent)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
|
@ -83,6 +91,7 @@ class UiInspector extends UiWidget {
|
|||
clear() {
|
||||
|
||||
this.clearTimeout = setTimeout(()=>{
|
||||
this.widget = null
|
||||
this.container.innerHTML = ''
|
||||
this.mounted = false
|
||||
this.clearTimeout = null
|
||||
|
|
@ -105,6 +114,8 @@ class UiInspector extends UiWidget {
|
|||
multi = widgets.length > 1,
|
||||
tabIndex = 1000
|
||||
|
||||
this.widget = widget
|
||||
|
||||
// this.form.appendChild(html`
|
||||
// <div class="separator">
|
||||
// <span class="${this.selectedWidgets.length > 1 ? 'accent' : ''}">
|
||||
|
|
@ -241,6 +252,45 @@ class UiInspector extends UiWidget {
|
|||
|
||||
}
|
||||
|
||||
help(name) {
|
||||
|
||||
var defaultValue = defaults[this.widget.getProp('type')][name],
|
||||
dynamic = this.widget.isDynamicProp(name),
|
||||
htmlHelp = Array.isArray(defaultValue.help) ? defaultValue.help.join('<br/><br/>').replace(/<br\/>-/g, '-') : defaultValue.help
|
||||
|
||||
htmlHelp = htmlHelp ? html`<p class="help">${raw(htmlHelp.replace(/`([^`]*)`/g, '<code>$1</code>'))}</p>` : ''
|
||||
|
||||
DOM.each(htmlHelp, 'a', (el)=>{
|
||||
el.target = '_blank'
|
||||
})
|
||||
|
||||
var htmlError = false ? html`<p class="error">${error}</p>` : '',
|
||||
computedValue = this.widget.getProp(name)
|
||||
|
||||
if (typeof computedValue === 'string') {
|
||||
try {
|
||||
computedValue = JSON.stringify(JSON.parse(computedValue), null, ' ')
|
||||
} catch(e) {}
|
||||
} else {
|
||||
computedValue = JSON.stringify(computedValue, null, ' ')
|
||||
}
|
||||
|
||||
new UiModal({closable: true, title: html`<span class="editor-help-title">${name}</span>`, content: html`
|
||||
<div class="inspector-help">
|
||||
|
||||
<p>Type: <code>${defaultValue.type}</code></p>
|
||||
<p>Default: <code>${JSON.stringify(defaultValue.value)}</code></p>
|
||||
<p>Dynamic: <code>${dynamic ? 'true' : 'false'}</code></p>
|
||||
<p>Computed: <code class="pre">${computedValue}</code></p>
|
||||
|
||||
${htmlError}
|
||||
|
||||
${htmlHelp}
|
||||
</div>
|
||||
`})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = UiInspector
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ var UiWidget = require('./ui-widget'),
|
|||
raw = require('nanohtml/raw'),
|
||||
MODAL_SINGLETON = null,
|
||||
MODAL_CONTAINER = null
|
||||
|
||||
|
||||
class UiModal extends UiWidget {
|
||||
|
||||
constructor(options) {
|
||||
|
|
@ -41,6 +41,9 @@ class UiModal extends UiWidget {
|
|||
</div>
|
||||
`
|
||||
|
||||
if (options.width) this.container.style.setProperty('--width', options.width + 'rem')
|
||||
if (options.height) this.container.style.setProperty('--height', options.height + 'rem')
|
||||
|
||||
if (options.closable) {
|
||||
var closer = DOM.get(this.container, '.popup-title .closer')[0]
|
||||
this.container.addEventListener('fast-click',(e)=>{
|
||||
|
|
|
|||
|
|
@ -765,7 +765,8 @@ class Widget extends EventEmitter {
|
|||
|
||||
case 'visible':
|
||||
this.setVisibility()
|
||||
resize.check(this.container)
|
||||
var container = this.parent !== widgetManager && this.parent.getProp('layout') !== 'default' ? this.parent.container : this.container
|
||||
resize.check(container)
|
||||
return
|
||||
|
||||
case 'interaction':
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
.widget.editing {
|
||||
z-index: 9999!important;
|
||||
}
|
||||
.widget.editing:after,
|
||||
.tablink.editing:after,
|
||||
.modal-container.editing > .popup > .popup-wrapper:after {
|
||||
content:"";
|
||||
z-index: 999!important;
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
border:1rem solid var(--color-accent);
|
||||
|
||||
--opa1: rgba(0,0,0, 1);
|
||||
--opa2: rgba(0,0,0, 0.2);
|
||||
--opa3: rgba(0,0,0, 0.8);
|
||||
-webkit-mask: linear-gradient(to right, var(--opa1) 10rem, var(--opa1) 10rem, var(--opa2) 10rem, var(--opa2) calc(100% - 10rem), var(--opa1) calc(100% - 10rem), var(--opa1)),
|
||||
linear-gradient(to bottom, var(--opa2) 10rem, var(--opa2) 10rem, var(--opa3) 10rem, var(--opa3) calc(100% - 10rem), var(--opa2) calc(100% - 10rem), var(--opa2)) ;
|
||||
-webkit-mask-composite: xor;
|
||||
|
||||
pointer-events: none;
|
||||
box-shadow: none!important;
|
||||
opacity: 1!important;
|
||||
}
|
||||
|
||||
// GRID
|
||||
|
||||
.editor-enabled {
|
||||
&:not(.no-grid) {
|
||||
.root-container,
|
||||
.tab-container,
|
||||
.modal-container,
|
||||
.panel-container {
|
||||
> inner {
|
||||
background-image: linear-gradient(to bottom, var(--color-grid) 1rem, transparent 1rem),
|
||||
linear-gradient(to right, var(--color-grid) 1rem, transparent 1rem);
|
||||
--size: calc(var(--grid-width) * 1rem);
|
||||
background-size: var(--size) var(--size);
|
||||
background-attachment: local;
|
||||
background-position: 0rem 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.widget:not(.not-editable) {
|
||||
pointer-events: initial!important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Help popup
|
||||
|
||||
.editor-help {
|
||||
.error {
|
||||
color: red;
|
||||
margin-top: 10rem;
|
||||
}
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
code {
|
||||
color: var(--color-accent);
|
||||
padding: 1rem 3rem;
|
||||
background: rgba(black, 0.2);
|
||||
display: inline-block;
|
||||
user-select: auto;
|
||||
cursor: auto;
|
||||
::selection{/* reset */}
|
||||
}
|
||||
a {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pre {
|
||||
white-space: pre;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
.help {
|
||||
margin-top: 10rem;
|
||||
}
|
||||
}
|
||||
.editor-help-title {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
// selectable
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
@import 'ui';
|
||||
|
||||
@import 'editor';
|
||||
@import 'widgets';
|
||||
|
||||
input,
|
||||
|
|
@ -313,7 +312,6 @@ body {
|
|||
cursor: initial;
|
||||
}
|
||||
overflow:auto;
|
||||
background: var(--color-bg);
|
||||
white-space:pre;
|
||||
font-family: monospace;
|
||||
font-weight:bold;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
@import 'ui/scrollbars';
|
||||
@import 'ui/workspaces';
|
||||
@import 'ui/notifications';
|
||||
@import 'ui/grid';
|
||||
@import 'ui/inspector';
|
||||
@import 'ui/tree';
|
||||
@import 'ui/dragresize';
|
||||
|
|
@ -9,6 +10,5 @@
|
|||
@import 'ui/contextmenu';
|
||||
@import 'ui/modal';
|
||||
@import 'ui/filebrowser';
|
||||
@import 'ui/lobby';
|
||||
@import 'ui/loading';
|
||||
@import 'ui/toolbar';
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
$padding: 8rem;
|
||||
|
||||
.file-browser {
|
||||
|
||||
width: 540rem;
|
||||
height: 360rem;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 2rem $padding $padding;
|
||||
background: var(--color-ui-background);
|
||||
|
||||
|
||||
.ariane {
|
||||
height: 40rem;
|
||||
|
|
|
|||
|
|
@ -235,11 +235,15 @@ osc-inspector-color {
|
|||
}
|
||||
|
||||
.color-picker-modal {
|
||||
padding: 8rem;
|
||||
background: var(--color-ui-background);
|
||||
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.widget {
|
||||
background: var(--color-background);
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.actions {
|
||||
|
|
@ -256,3 +260,39 @@ osc-inspector-color {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.inspector-help {
|
||||
|
||||
width: 100%;
|
||||
padding: 8rem;
|
||||
background: var(--color-background);
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
margin-top: 10rem;
|
||||
}
|
||||
em {
|
||||
font-style: italic;
|
||||
}
|
||||
code {
|
||||
color: var(--color-accent);
|
||||
padding: 1rem 3rem;
|
||||
background: rgba(black, 0.2);
|
||||
display: inline-block;
|
||||
user-select: auto;
|
||||
cursor: auto;
|
||||
::selection{/* reset */}
|
||||
}
|
||||
a {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pre {
|
||||
white-space: pre;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
.help {
|
||||
margin-top: 10rem;
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,72 +0,0 @@
|
|||
$padding: 8rem;
|
||||
|
||||
.lobby {
|
||||
|
||||
width: 540rem;
|
||||
height: 360rem;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
background: var(--color-ui-background);
|
||||
padding: 2rem $padding $padding;
|
||||
|
||||
.list {
|
||||
overflow: auto;
|
||||
text-transform: none;
|
||||
flex: 1;
|
||||
background: var(--color-background);
|
||||
padding: 0 $padding;
|
||||
a {
|
||||
padding-right: 30rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: $padding;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
flex-grow: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
a {
|
||||
margin-left: $padding;
|
||||
text-align: center;
|
||||
background: var(--color-background);
|
||||
&:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
a {
|
||||
padding: 0;
|
||||
position: relative;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
width: 100%;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
background: none;
|
||||
em, i {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
right:0rem;
|
||||
top:0rem;
|
||||
z-index: 1;
|
||||
height: 40rem;
|
||||
line-height: 40rem;
|
||||
opacity: 0.5;
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ $padding: 8rem;
|
|||
|
||||
@keyframes popup-backdrop-fade-in {
|
||||
0% {opacity: 0}
|
||||
100% {opacity: .1}
|
||||
100% {opacity: .03}
|
||||
}
|
||||
|
||||
.popup {
|
||||
|
|
@ -15,10 +15,10 @@ $padding: 8rem;
|
|||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
background: black;
|
||||
opacity: .1;
|
||||
background: white;
|
||||
opacity: .03;
|
||||
pointer-events: none;
|
||||
animation: popup-backdrop-fade-in .25s forwards;
|
||||
// animation: popup-backdrop-fade-in .25s forwards;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -29,11 +29,11 @@ $padding: 8rem;
|
|||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
padding:10%;
|
||||
align-items:center;
|
||||
justify-content: center;
|
||||
z-index: 99999999;
|
||||
display: none;
|
||||
padding: 20rem;
|
||||
|
||||
&.show {
|
||||
display: flex;
|
||||
|
|
@ -80,13 +80,20 @@ $padding: 8rem;
|
|||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width:auto;
|
||||
max-width:600rem;
|
||||
max-height: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: var(--width, 540rem);
|
||||
height: var(--height, auto);
|
||||
|
||||
.popup-content {
|
||||
flex:1;
|
||||
width: auto;
|
||||
padding: 2rem $padding $padding;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,3 +17,30 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.widget.editing {
|
||||
z-index: 9999!important;
|
||||
}
|
||||
.widget.editing:after,
|
||||
.tablink.editing:after,
|
||||
.modal-container.editing > .popup > .popup-wrapper:after {
|
||||
content:"";
|
||||
z-index: 999!important;
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
border:1rem solid var(--color-accent);
|
||||
|
||||
--opa1: rgba(0,0,0, 1);
|
||||
--opa2: rgba(0,0,0, 0.2);
|
||||
--opa3: rgba(0,0,0, 0.8);
|
||||
-webkit-mask: linear-gradient(to right, var(--opa1) 10rem, var(--opa1) 10rem, var(--opa2) 10rem, var(--opa2) calc(100% - 10rem), var(--opa1) calc(100% - 10rem), var(--opa1)),
|
||||
linear-gradient(to bottom, var(--opa2) 10rem, var(--opa2) 10rem, var(--opa3) 10rem, var(--opa3) calc(100% - 10rem), var(--opa2) calc(100% - 10rem), var(--opa2)) ;
|
||||
-webkit-mask-composite: xor;
|
||||
|
||||
pointer-events: none;
|
||||
box-shadow: none!important;
|
||||
opacity: 1!important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,11 +429,8 @@
|
|||
padding:0;
|
||||
|
||||
> .popup-wrapper {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: var(--width, 100%);
|
||||
height: var(--height, 100%);
|
||||
display: flex;
|
||||
.popup-content {
|
||||
// contain:unset; // == no restrain
|
||||
&:before {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue