diff --git a/Changelog.md b/Changelog.md index aeb48d4..8031743 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,12 @@ +# 0.14.0 + +29.04kb, 8.31kb gzipped + +- Added `gui.onFinishChange` for symmetry with `gui.onChange`. +- Added a `d.ts` file for TypeScript users. +- Fixed a bug that stopped iOS users from typing negative numbers. ([Note](https://github.com/georgealways/lil-gui/pull/16)) +- Minor CSS fixes. + # 0.13.0 28.56kb, 8.24kb gzipped diff --git a/Guide.md b/Guide.md index c6ec886..3fcfd73 100644 --- a/Guide.md +++ b/Guide.md @@ -23,14 +23,14 @@ For quick sketches, you can import lil-gui directly from a CDN. ```html ``` The library is also available in UMD format under the namespace `lil`. ```html - + @@ -202,6 +202,8 @@ gui.onChange( event => { `GUI.onChange` events bubble upward. A handler applied to the root GUI will fire after every change. Handlers applied to folders will only be called after changes to that folder or its descendents. +`GUI.onFinishChange` works just like `GUI.onChange`, but it only fires at the end of change events. + ### Listening and Updating If a value controlled by the GUI is changed in code anywhere outside of the GUI, the new value won't diff --git a/TODO b/TODO index 22cbc4f..7166e08 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,21 @@ 0.14 -[ ] GUI.onFinishChange (branch: undo) -[ ] ios negative numbers (branch: typenumber) +[x] GUI.onFinishChange (branch: undo) +[x] 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 +[-] -webkit-tap-highlight is still on boolean and option + but there's no :active style on either without it (branch: mobileactivestates) + +[-] button text-transform: none + this was there to compensate for a very broad css selector in the three.js + examples while developing, shouldn't be there. + well, in truth there's a bunch of 'resets' in the .lil-gui { selector too + +[-] move --string-color and --number-color to inputs.scss + 0.13 [-] test color malform/edge cases diff --git a/examples/kitchen-sink/index.html b/examples/kitchen-sink/index.html index 7b39534..3bdf3f2 100644 --- a/examples/kitchen-sink/index.html +++ b/examples/kitchen-sink/index.html @@ -308,6 +308,10 @@ gui.addColor( { Color: 0xaa00ff }, 'Color' ).onChange( change ).onFinishChange( finishChange ); + gui.onFinishChange( e => { + console.log( 'gui.onFinishChange', e ); + } ); + } ); make( { title: 'Customization' }, gui => { diff --git a/package-lock.json b/package-lock.json index 3f432e9..db856d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lil-gui", - "version": "0.13.0", + "version": "0.14.0-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lil-gui", - "version": "0.13.0", + "version": "0.14.0-dev", "license": "MIT", "devDependencies": { "browser-sync": "^2.27.7", @@ -19,9 +19,11 @@ "jsdoc-api": "^5.0.2", "markdown-it": "^9.1.0", "onchange": "^6.0.0", + "rimraf": "^3.0.2", "rollup": "^1.17.0", "sass": "^1.22.10", "terser": "^4.3.8", + "typescript": "^4.5.2", "webfont": "^11.2.26" } }, @@ -4547,6 +4549,19 @@ "node": ">=8" } }, + "node_modules/typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", @@ -8570,6 +8585,12 @@ "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, + "typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true + }, "typical": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", diff --git a/package.json b/package.json index 6d0cf0d..56b5523 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lil-gui", - "version": "0.13.0", + "version": "0.14.0-dev", "author": { "name": "George Michael Brower" }, @@ -8,6 +8,7 @@ "homepage": "https://lil-gui.georgealways.com", "module": "dist/lil-gui.esm.js", "main": "dist/lil-gui.umd.js", + "types": "dist/lil-gui.esm.d.ts", "config": { "style": "dist/lil-gui.css", "styleMin": "dist/lil-gui.min.css" @@ -15,17 +16,19 @@ "scripts": { "build": "npm run icons && npm run sass && npm run sass:min && npm run rollup", "build:all": "npm run build && npm run api && npm run homepage", - "sass": "sass style/index.scss $npm_package_config_style --no-source-map --no-charset", - "sass:min": "sass style/index.scss $npm_package_config_styleMin --no-charset --no-source-map --style=compressed", + "sass": "sass style/index.scss dist/lil-gui.css --no-charset --no-source-map", + "sass:min": "sass style/index.scss dist/lil-gui.min.css --no-charset --no-source-map --style=compressed", "rollup": "rollup -c", "lint": "eslint .", "icons": "node -r esm scripts/icons.js", "test": "node -r esm tests/utils/runner.js", "api": "node -r esm scripts/api.js --write", + "types": "tsc dist/lil-gui.esm.js --declaration --allowJs --emitDeclarationOnly --outDir dist", "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", + "server": "browser-sync start -s -f 'dist' 'index.html' 'examples' --no-open --no-notify --no-ui --no-ghost-mode --no-inject-changes", + "clean": "rimraf -rf dist/*", "preversion": "npm run build && npm test", - "prepublishOnly": "npm run build && npm test", + "prepublishOnly": "npm run clean && npm run build && npm run types && npm test", "dev": "npm run build:all && node -r esm scripts/dev.js" }, "files": [ @@ -43,9 +46,11 @@ "jsdoc-api": "^5.0.2", "markdown-it": "^9.1.0", "onchange": "^6.0.0", + "rimraf": "^3.0.2", "rollup": "^1.17.0", "sass": "^1.22.10", "terser": "^4.3.8", + "typescript": "^4.5.2", "webfont": "^11.2.26" }, "eslintIgnore": [ diff --git a/scripts/api.js b/scripts/api.js index fee3d84..3428fa6 100644 --- a/scripts/api.js +++ b/scripts/api.js @@ -254,7 +254,7 @@ function paramsToSignature( params ) { .map( singleParamToSignature ) .join( ', ' ); - return `( ${paramList} )`; + return `( ${paramList} )`; } diff --git a/scripts/homepage.hbs.html b/scripts/homepage.hbs.html index 3b79cb2..bc60038 100644 --- a/scripts/homepage.hbs.html +++ b/scripts/homepage.hbs.html @@ -22,10 +22,10 @@ --link: #005dcc; --pre-code: #d1d0cc; --inline-code: #926501; - --code-number: #73c6ee; - --code-string: #a3c04a; - --code-literal: #db80c7; - --code-special: #6ed3d3; + --code-number: #6cb2e3; + --code-string: #a6bf5c; + --code-literal: #bd75cb; + --code-special: #80d3c7; --code-comment: #84858a; --pre-background: #372d39; --toc-width: 210px; @@ -972,7 +972,7 @@