Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.13.0 #11

Merged
merged 92 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
bc6a811
onfinishchange first pass
georgealways Nov 8, 2021
bd29c6b
Merge branch 'dev' into finishchange
georgealways Nov 8, 2021
f1c7231
v0.13.0-dev
georgealways Nov 9, 2021
85e4ea1
update todos
georgealways Nov 9, 2021
9054dd8
vertical drag unit tests
georgealways Nov 9, 2021
79fe38a
Merge branch 'dev' into finishchange
georgealways Nov 10, 2021
e876f9e
kitchen sink tallies
georgealways Nov 10, 2021
1f1c6f4
hide button for autoplace in kitchen sink
georgealways Nov 10, 2021
e430bc2
Merge branch 'dev' into finishchange
georgealways Nov 10, 2021
082488f
wheels on slider trigger finishchange
georgealways Nov 10, 2021
ffdcbc7
update todos
georgealways Nov 10, 2021
e9d1c2f
anonymize debounce function
georgealways Nov 10, 2021
02eb241
onfinishchange guide
georgealways Nov 10, 2021
f216a24
onfinishchange jsdoc
georgealways Nov 10, 2021
61cd148
api excludes protected members
georgealways Nov 10, 2021
8d97852
fix error in jsdoc example
georgealways Nov 10, 2021
5a77fad
Merge branch 'dev' into finishchange
georgealways Nov 10, 2021
29734bd
spaces
georgealways Nov 10, 2021
49c4731
lint
georgealways Nov 10, 2021
25757ac
Merge branch 'dev' into finishchange
georgealways Nov 10, 2021
25f4bd0
jsdoc _callOnChange
georgealways Nov 10, 2021
6d2dc58
onFinishChange jsdoc
georgealways Nov 10, 2021
0af8a74
unit test number ctrl finish change
georgealways Nov 10, 2021
67c55da
fix _changed=false in slider drag start
georgealways Nov 10, 2021
e6d8f6a
Source => GitHub
georgealways Nov 10, 2021
7dec02d
hide homepage autoplace gui sooner
georgealways Nov 10, 2021
7d6319a
Merge branch 'dev' into finishchange
georgealways Nov 10, 2021
6398e71
inline wheel debounce function
georgealways Nov 10, 2021
2219fd0
use bind to define debounce function
georgealways Nov 10, 2021
ec2eb59
_change = false becomes _onChangeStart()
georgealways Nov 10, 2021
a146427
less confusing gui.add failure message
georgealways Nov 11, 2021
36ef227
update todos
georgealways Nov 11, 2021
f936f94
clarify _onChangeStart comment
georgealways Nov 11, 2021
6881de4
shimmed input element calls focus event
georgealways Nov 11, 2021
8c9c130
focused input updates while wheeling slider
georgealways Nov 11, 2021
91d2d0a
Merge branch 'dev' into finishchange
georgealways Nov 11, 2021
0f335fa
better mousewheel debounce comment
georgealways Nov 11, 2021
0ef58b5
onwheel cleanup
georgealways Nov 11, 2021
06fcc58
onfinishchange guide copy fix
georgealways Nov 11, 2021
7bf6080
homepage example results match example code again
georgealways Nov 11, 2021
0a5f65a
remove onfinishchange from removed features in migrate
georgealways Nov 11, 2021
5b2d44e
Merge pull request #9 from georgealways/finishchange
georgealways Nov 11, 2021
7c2967e
_initInput binds listeners near def, no passive false
georgealways Nov 11, 2021
8811a74
remove passive false
georgealways Nov 11, 2021
b2fd690
simplify clamp
georgealways Nov 11, 2021
6afe9b2
numberctrl function call order consistency
georgealways Nov 11, 2021
7c06572
gui.load fails quietly on {}
georgealways Nov 11, 2021
b094aa6
initial split
georgealways Nov 12, 2021
42ce04e
rename on change tests
georgealways Nov 12, 2021
a2f6d0d
remove console log
georgealways Nov 12, 2021
7a75d20
update dev script for new tests
georgealways Nov 12, 2021
09c7184
simplify arg processing
georgealways Nov 12, 2021
0b48716
update todos
georgealways Nov 12, 2021
2192694
merge small api tests
georgealways Nov 12, 2021
7c93e6b
rename color parsing test
georgealways Nov 12, 2021
e085474
explain thyself
georgealways Nov 12, 2021
4d5172b
drop .test.js suffix
georgealways Nov 12, 2021
6a44d04
better test names
georgealways Nov 12, 2021
3d27634
runner cleanup
georgealways Nov 12, 2021
d24cac3
move open-animated to basic
georgealways Nov 12, 2021
e8888a0
finish simulateDrag jsdoc
georgealways Nov 12, 2021
387f040
mark test todos
georgealways Nov 12, 2021
d308d52
basic test arg order
georgealways Nov 12, 2021
ee534e7
Merge pull request #10 from georgealways/splittest
georgealways Nov 12, 2021
bf615f6
reset calls onfinishchange
georgealways Nov 12, 2021
0eae48a
update todos
georgealways Nov 12, 2021
0a1c959
update todos
georgealways Nov 12, 2021
ba67284
extract spy to utils/spy
georgealways Nov 12, 2021
14b1cd3
allow async tests
georgealways Nov 12, 2021
539d350
controller.listen test
georgealways Nov 12, 2021
7e3c41f
color controller listen updates sparingly
georgealways Nov 12, 2021
d5057a9
kitchen autoplace gui hide sets hash
georgealways Nov 12, 2021
c70a9ce
update todos
georgealways Nov 12, 2021
1c395f3
load calls onFinishChange and returns self
georgealways Nov 12, 2021
54fc02b
define remaining 0.13 todos
georgealways Nov 13, 2021
c789516
revert value change check in listen
georgealways Nov 13, 2021
294ecb1
changelog and todos
georgealways Nov 13, 2021
7a8d221
style consistency _initSlider _initInput
georgealways Nov 13, 2021
cedb6d8
update todos
georgealways Nov 13, 2021
e9ab7c7
reduce indentation on gui.add error message
georgealways Nov 13, 2021
43541c8
color reset retains references test
georgealways Nov 13, 2021
b11c1d4
revert async test support
georgealways Nov 13, 2021
eb356a8
update todos
georgealways Nov 13, 2021
d00ca58
fix slow incremenets for notched mouse wheel
georgealways Nov 13, 2021
598a152
comment lint
georgealways Nov 13, 2021
74c4d3d
changelog
georgealways Nov 13, 2021
6018e87
changelog
georgealways Nov 14, 2021
297ca8c
jsdoc typo
georgealways Nov 14, 2021
42dde5d
_onChangeStart is unnecessary
georgealways Nov 15, 2021
105aa0f
inline event listener for consistency
georgealways Nov 15, 2021
f570c61
changelog
georgealways Nov 15, 2021
495c3a4
whitespace
georgealways Nov 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ rules:
jsdoc/require-description: warn
jsdoc/tag-lines: [ warn, any ]
overrides:
- files: [ rollup.config.js, scripts/**/*.js ]
- files: [ rollup.config.js, scripts/**/*.js, tests/**/*.js ]
env:
node: true
parserOptions:
ecmaVersion: 9
- files: [ rollup.config.js, scripts/**/*.js, examples/**/*.js ]
- files: [ rollup.config.js, scripts/**/*.js, tests/**/*.js, examples/**/*.js ]
rules:
no-console: off
max-len: off
jsdoc/require-description: off
- files: [ scripts/test.js ]
- files: [ tests/*.test.js ]
rules:
no-console: warn
10 changes: 10 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 0.13.0

28.56kb, 8.24kb gzipped

- Added support for `onFinishChange`.
- The error message when `gui.add` fails is easier to read.
- `gui.load` ignores empty objects instead of failing.
- Fixed a bug that caused mouse wheels to change values too slowly.
- Reverted `listen()` fix from 0.11.0. ([Note](https://github.com/georgealways/lil-gui/pull/11/files#r748852628))

# 0.12.0

28.11kb, 8.24kb gzipped
Expand Down
6 changes: 6 additions & 0 deletions Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ gui.add( params, 'foo' ).onChange( value => {
} );
```

The `onFinishChange` handler fires after a controller changes and loses focus. This comes in handy if you're using a slow function with a controller that produces continuous change events (like numbers or colors for example).

```js
gui.add( params, 'mySlider', 0, 1 ).onFinishChange( complexFunction );
```

### Global Change Handlers

GUI also provides an `onChange` handler that fires after changes to any of its children.
Expand Down
2 changes: 0 additions & 2 deletions Migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ The other differences in color handling are fairly minor:
- "Presets" and `gui.remember()` are gone in favor of `save/load()`, which also removes
mention of `localStorage`.
- `gui.hide/show/hideAll()` and the <key>H</key> to hide hotkey.
- `onFinishChange`. The method is left as an `onChange` synonym for backwards
compatibility.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Makes a floating panel for controllers on the web. Works as a drop-in replacement for dat.gui.

[**Homepage**](https://lil-gui.georgealways.com/) • [**Basic Demo**](https://lil-gui.georgealways.com/examples/basic/) • [Examples](https://lil-gui.georgealways.com/#Examples) • [Guide](https://lil-gui.georgealways.com/#Guide) • [API](https://lil-gui.georgealways.com/#API) • [Source](https://github.com/georgealways/lil-gui)
[**Homepage**](https://lil-gui.georgealways.com/) • [**Basic Demo**](https://lil-gui.georgealways.com/examples/basic/) • [Examples](https://lil-gui.georgealways.com/#Examples) • [Guide](https://lil-gui.georgealways.com/#Guide) • [API](https://lil-gui.georgealways.com/#API) • [GitHub](https://github.com/georgealways/lil-gui)

```js
import GUI from 'lil-gui';
Expand Down
45 changes: 37 additions & 8 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
[ ] feels like a lot of uneccessary { passive: false }, esp numbercontroller
[ ] unit test for import/export recursive=false
[ ] unit test for number box vertical drag
0.14

[ ] number slider should blur input on mousewheel
[ ] close() should accept a parameter like disable() for symmetry with open() ?
[ ] show()/hide(), ._hidden, hideKey: 'h'
[ ] GUI.onFinishChange (branch: undo)
[ ] ios negative numbers (branch: typenumber)
the spec for inputmode=decimal doesn't mandate a negative sign
only way to default to a keyboard with numbers, decimals and a negative sign
on ios is with input[type=number]. i hate unstyling that thing

0.13

[-] test color malform/edge cases
current behavior is fine imo, don't want to bloat it with error message strings
[x] test reset color arr/obj

[x] revert the change check in listen().
i thought this was needed to keep controllers interactive because of
a three.js example "webgl_clipping_advanced" -- there was a checkbox that is
deliberately uncheckable and i thought listen() was causing this

[-] function controller on(finish)change?
[-] close() should accept a parameter like disable() for symmetry with open()
[x] onFinishChange on reset
[x] load should return this
[x] load should call onfinishchange

[-] mousewheel/slider key modifiers
would require keeping track of a cumulative delta like vertical drag
[-] show()/hide(), ._hidden, hideKey: 'h' ?
rarely find myself needing anything more than gui.domElement.style.display = 'none';

[x] better gui.add/addColor failure message
too many ways addColor can fail, just gonna let it yell at you for now
[x] unit test for number box vertical drag

[x] number slider should blur input on mousewheel
[x] no more passive false

[x] i'd like to make it easier to find/view the built source.
[x] @VERSION swapout for guide in cdn example
Expand Down Expand Up @@ -49,7 +78,8 @@ homepage
OTHER
[x] i don't like how some anchors are inside h1/2/3 and some aren't. if they're all above the
header in question i don't need --anchor offset. they only hafta be inside the header for .md
[ ] order of properties (not methods) in API is kinda wonky
[-] order of properties (not methods) in API is kinda wonky
no it's not it's a-z$_
[x] main api toc columns are ugly
[x] !! update anchor positions on resize

Expand Down Expand Up @@ -237,7 +267,6 @@ archive
will try again
[x] i like it


[x] move kitchen sink from homepage to panopticon.
(that should be a simple demo)

Expand Down
51 changes: 47 additions & 4 deletions examples/kitchen-sink/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
string: 'lil-gui',
number: 0.5,
color: '#aa00ff',
function() { alert( 'hi' ); }
hide() {
autoPlaceGUI.domElement.style.display = 'none';
location.hash = '#hide';
}
};

const autoPlaceGUI = new GUI( { title: 'autoPlace' } );
Expand All @@ -57,7 +60,7 @@
autoPlaceGUI.add( myObject, 'string' );
autoPlaceGUI.add( myObject, 'number', 0, 1 );
autoPlaceGUI.addColor( myObject, 'color' );
autoPlaceGUI.add( myObject, 'function' );
autoPlaceGUI.add( myObject, 'hide' );

const container = document.getElementById( 'container' );

Expand All @@ -67,6 +70,10 @@
}
}

if ( location.hash === '#hide' ) {
myObject.hide();
}

/**
* @param {object} options
* @param {function(GUI)} callback
Expand Down Expand Up @@ -218,8 +225,8 @@
gui.add( { Options: 'a' }, 'Options', ['a', 'b', 'c'] ).disable().enable();
gui.add( { Options: 'a' }, 'Options', ['a', 'b', 'c'] ).disable();

gui.add( { func() { console.log( 'hi' ) } }, 'func' ).name('Function').disable().enable();
gui.add( { func() { console.log( 'hi' ) } }, 'func' ).name('Function').disable();
gui.add( { func() { console.log( 'hi' ) } }, 'func' ).name( 'Function' ).disable().enable();
gui.add( { func() { console.log( 'hi' ) } }, 'func' ).name( 'Function' ).disable();

gui.addColor( { Color: 0xaa00ff }, 'Color' ).disable().enable();
gui.addColor( { Color: 0xaa00ff }, 'Color' ).disable();
Expand Down Expand Up @@ -267,6 +274,42 @@

} );

make( { title: 'onChange' }, gui => {

const tallies = { onChange: 0, onFinishChange: 0 };

function change() {
console.log( this.property + ' onChange' );
tallies.onChange++;
}

function finishChange() {
console.log( this.property + ' onFinishChange' );
tallies.onFinishChange++;
}

let folder;

folder = gui.addFolder('Tallies');
folder.add( tallies, 'onChange' ).disable().listen();
folder.add( tallies, 'onFinishChange' ).disable().listen();

gui.add( { Number: 0 }, 'Number' ).onChange( change ).onFinishChange( finishChange );

gui.add( { Slider: 0 }, 'Slider', 0, 1 ).onChange( change ).onFinishChange( finishChange );

gui.add( { String: 'foo' }, 'String' ).onChange( change ).onFinishChange( finishChange );

gui.add( { Boolean: true }, 'Boolean' ).onChange( change ).onFinishChange( finishChange );

gui.add( { Options: 'a' }, 'Options', ['a', 'b', 'c'] ).onChange( change ).onFinishChange( finishChange );

gui.add( { func() { console.log( 'hi' ) } }, 'func' ).onChange( change ).onFinishChange( finishChange );

gui.addColor( { Color: 0xaa00ff }, 'Color' ).onChange( change ).onFinishChange( finishChange );

} );

make( { title: 'Customization' }, gui => {

const pre = document.createElement( 'pre' );
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lil-gui",
"version": "0.12.0",
"version": "0.13.0-dev",
"author": {
"name": "George Michael Brower"
},
Expand All @@ -20,7 +20,7 @@
"rollup": "rollup -c",
"lint": "eslint .",
"icons": "node -r esm scripts/icons.js",
"test": "node -r esm scripts/test.js",
"test": "node -r esm tests/utils/runner.js",
"api": "node -r esm scripts/api.js --write",
"homepage": "node -r esm scripts/homepage.js",
"server": "browser-sync start -s -f '$npm_package_main' 'index.html' 'examples' --no-open --no-notify --no-ui --no-ghost-mode --no-inject-changes",
Expand Down
2 changes: 2 additions & 0 deletions scripts/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jsdoc.explainSync( { files: JSDOC_INPUT } )

function transform( v ) {

if ( v.access === 'protected' ) return;

forEachRecursive( v, ( object, key, value ) => {

if ( typeof value === 'string' ) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev( {
'test': {
onchange: [
pkg.module,
'scripts/test*'
'tests/**/*.js'
],
flag: '--soft-fail',
color: 'yellow'
Expand Down
25 changes: 14 additions & 11 deletions scripts/homepage.hbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,15 @@
margin: 0;
}

@media (max-width: 1200px) {

.autoPlace {
opacity: 0;
pointer-events: none;
}

}

/* small desktop */

@media (max-width: 958px) {
Expand Down Expand Up @@ -478,12 +487,6 @@
padding: 0 1rem;
}

.autoPlace {
opacity: 0;
pointer-events: none;
transition: none !important;
}

}

/* mobile */
Expand Down Expand Up @@ -569,7 +572,7 @@
}
hidden = passed;
}
document.addEventListener( 'scroll', onScroll, { passive: false } );
document.addEventListener( 'scroll', onScroll );
onScroll();

// Delay transition class so we don't see a fadeout flash on load
Expand Down Expand Up @@ -662,7 +665,7 @@
activeLink.scrollIntoView( { block: 'nearest' } );
}

document.addEventListener( 'scroll', onScroll, { passive: true } );
document.addEventListener( 'scroll', onScroll );
window.addEventListener( 'resize', debounce( updateAnchorPositions ) );

requestAnimationFrame( () => {
Expand Down Expand Up @@ -835,7 +838,7 @@

} );

example( 16, ( gui, code ) => {
example( 17, ( gui, code ) => {

const params = { feedback: 0 };

Expand All @@ -850,7 +853,7 @@

} );

example( 17, ( gui, code ) => {
example( 18, ( gui, code ) => {

let saved = {};

Expand Down Expand Up @@ -968,7 +971,7 @@ <h2><a href="#API">API</a></h2>
<section id="section-readme">
{{{ readme }}}

<a href="{{ builds.module }}">Built source</a> •
<a href="{{ builds.module }}">Built Source</a> •
<a href="{{ builds.moduleMin }}">Minified</a> = <strong>{{ sizeMin }}kb</strong>, {{ sizeGzip }}kb gzipped

</section>
Expand Down
57 changes: 0 additions & 57 deletions scripts/test-runner.js

This file was deleted.

Loading