Permalink
Browse files

Merge branch 'hello-typescript'

  • Loading branch information...
cocopon committed Dec 25, 2018
2 parents fc8ce65 + 53101ab commit 07634301df06c8ffb3863a7f3b2245cac87775bd
Showing with 1,585 additions and 1,798 deletions.
  1. +0 −9 .babelrc
  2. +1 −1 .editorconfig
  3. +0 −45 .eslintrc
  4. +0 −19 .flowconfig
  5. +23 −27 package.json
  6. +3 −3 src/doc/js/{bundle.js → bundle.ts}
  7. +13 −10 src/doc/js/route/{index.js → index.ts}
  8. +24 −22 src/doc/js/route/{input.js → input.ts}
  9. +41 −30 src/doc/js/route/{misc.js → misc.ts}
  10. +18 −14 src/doc/js/route/{monitor.js → monitor.ts}
  11. +7 −9 src/doc/js/{simple-router.js → simple-router.ts}
  12. +38 −36 src/doc/js/{sketch.js → sketch.ts}
  13. +0 −5 src/doc/js/util.js
  14. +3 −0 src/doc/js/util.ts
  15. +0 −2 src/main/js/api/{button-test.js → button-test.ts}
  16. +3 −4 src/main/js/api/{button.js → button.ts}
  17. +2 −4 src/main/js/api/{folder-test.js → folder-test.ts}
  18. +15 −14 src/main/js/api/{folder.js → folder.ts}
  19. +3 −4 src/main/js/api/{input-binding-test.js → input-binding-test.ts}
  20. +12 −6 src/main/js/api/{input-binding.js → input-binding.ts}
  21. +3 −6 src/main/js/api/{monitor-binding-test.js → monitor-binding-test.ts}
  22. +8 −6 src/main/js/api/{monitor-binding.js → monitor-binding.ts}
  23. +4 −6 src/main/js/api/{preset-test.js → preset-test.ts}
  24. +3 −3 src/main/js/api/{preset.js → preset.ts}
  25. +1 −3 src/main/js/api/{root-boolean-input-test.js → root-boolean-input-test.ts}
  26. +1 −3 src/main/js/api/{root-color-input-test.js → root-color-input-test.ts}
  27. +0 −2 src/main/js/api/{root-event-test.js → root-event-test.ts}
  28. +1 −3 src/main/js/api/{root-input-test.js → root-input-test.ts}
  29. +14 −16 src/main/js/api/{root-misc-test.js → root-misc-test.ts}
  30. +1 −3 src/main/js/api/{root-monitor-test.js → root-monitor-test.ts}
  31. +6 −8 src/main/js/api/{root-number-input-test.js → root-number-input-test.ts}
  32. +2 −4 src/main/js/api/{root-number-monitor-test.js → root-number-monitor-test.ts}
  33. +2 −4 src/main/js/api/{root-string-input-test.js → root-string-input-test.ts}
  34. +2 −4 src/main/js/api/{root-string-monitor-test.js → root-string-monitor-test.ts}
  35. +1 −3 src/main/js/api/{root-ui-test.js → root-ui-test.ts}
  36. +20 −19 src/main/js/api/{root.js → root.ts}
  37. +7 −4 src/main/js/binding/{input-test.js → input-test.ts}
  38. +15 −17 src/main/js/binding/{input.js → input.ts}
  39. +7 −7 src/main/js/binding/{monitor-test.js → monitor-test.ts}
  40. +14 −16 src/main/js/binding/{monitor.js → monitor.ts}
  41. +4 −6 src/main/js/constraint/{composite-test.js → composite-test.ts}
  42. +6 −8 src/main/js/constraint/{composite.js → composite.ts}
  43. +0 −2 src/main/js/constraint/{constraint.js → constraint.ts}
  44. +1 −3 src/main/js/constraint/{list-test.js → list-test.ts}
  45. +10 −12 src/main/js/constraint/{list.js → list.ts}
  46. +1 −3 src/main/js/constraint/{range-test.js → range-test.ts}
  47. +10 −12 src/main/js/constraint/{range.js → range.ts}
  48. +1 −3 src/main/js/constraint/{step-test.js → step-test.ts}
  49. +0 −27 src/main/js/constraint/step.js
  50. +21 −0 src/main/js/constraint/step.ts
  51. +2 −4 src/main/js/constraint/{util-test.js → util-test.ts}
  52. +9 −7 src/main/js/constraint/{util.js → util.ts}
  53. +10 −15 src/main/js/controller/binding-creators/{boolean-input.js → boolean-input.ts}
  54. +6 −8 src/main/js/controller/binding-creators/{color-input.js → color-input.ts}
  55. +29 −23 src/main/js/controller/binding-creators/{input.js → input.ts}
  56. +9 −11 src/main/js/controller/binding-creators/{monitor.js → monitor.ts}
  57. +14 −19 src/main/js/controller/binding-creators/{number-input.js → number-input.ts}
  58. +29 −27 src/main/js/controller/binding-creators/{number-monitor.js → number-monitor.ts}
  59. +10 −15 src/main/js/controller/binding-creators/{string-input.js → string-input.ts}
  60. +14 −14 src/main/js/controller/binding-creators/{string-monitor.js → string-monitor.ts}
  61. +1 −3 src/main/js/controller/{button-test.js → button-test.ts}
  62. +7 −9 src/main/js/controller/{button.js → button.ts}
  63. +1 −3 src/main/js/controller/{folder-test.js → folder-test.ts}
  64. +23 −27 src/main/js/controller/{folder.js → folder.ts}
  65. +4 −5 src/main/js/controller/{input-binding-test.js → input-binding-test.ts}
  66. +9 −11 src/main/js/controller/{input-binding.js → input-binding.ts}
  67. +10 −12 src/main/js/controller/input/{checkbox.js → checkbox.ts}
  68. +17 −19 src/main/js/controller/input/{color-picker.js → color-picker.ts}
  69. +12 −14 src/main/js/controller/input/{color-swatch-text.js → color-swatch-text.ts}
  70. +13 −15 src/main/js/controller/input/{color-swatch.js → color-swatch.ts}
  71. +15 −17 src/main/js/controller/input/{h-palette.js → h-palette.ts}
  72. +3 −5 src/main/js/controller/input/{input.js → input.ts}
  73. +3 −5 src/main/js/controller/input/{list-test.js → list-test.ts}
  74. +18 −17 src/main/js/controller/input/{list.js → list.ts}
  75. +11 −11 src/main/js/controller/input/{number-text.js → number-text.ts}
  76. +12 −14 src/main/js/controller/input/{slider-text.js → slider-text.ts}
  77. +27 −24 src/main/js/controller/input/{slider.js → slider.ts}
  78. +15 −17 src/main/js/controller/input/{sv-palette.js → sv-palette.ts}
  79. +2 −4 src/main/js/controller/input/{text-test.js → text-test.ts}
  80. +0 −44 src/main/js/controller/input/text.js
  81. +42 −0 src/main/js/controller/input/text.ts
  82. +4 −8 src/main/js/controller/{monitor-binding-test.js → monitor-binding-test.ts}
  83. +9 −11 src/main/js/controller/{monitor-binding.js → monitor-binding.ts}
  84. +6 −8 src/main/js/controller/monitor/{color-swatch.js → color-swatch.ts}
  85. +15 −17 src/main/js/controller/monitor/{graph.js → graph.ts}
  86. +3 −5 src/main/js/controller/monitor/{monitor.js → monitor.ts}
  87. +8 −10 src/main/js/controller/monitor/{multi-log.js → multi-log.ts}
  88. +8 −10 src/main/js/controller/monitor/{single-log.js → single-log.ts}
  89. +1 −3 src/main/js/controller/{root-test.js → root-test.ts}
  90. +28 −29 src/main/js/controller/{root.js → root.ts}
  91. +1 −3 src/main/js/controller/{separator.js → separator.ts}
  92. +0 −25 src/main/js/controller/ui-util.js
  93. +27 −0 src/main/js/controller/ui-util.ts
  94. +0 −81 src/main/js/controller/ui.js
  95. +69 −0 src/main/js/controller/ui.ts
  96. +1 −3 src/main/js/converter/{boolean-test.js → boolean-test.ts}
  97. +1 −3 src/main/js/converter/{boolean.js → boolean.ts}
  98. +2 −3 src/main/js/converter/{color-test.js → color-test.ts}
  99. +1 −3 src/main/js/converter/{color.js → color.ts}
  100. +1 −3 src/main/js/converter/{number-test.js → number-test.ts}
  101. +1 −3 src/main/js/converter/{number.js → number.ts}
  102. +1 −3 src/main/js/converter/{string.js → string.ts}
  103. +4 −0 src/main/js/declarations.d.ts
  104. +17 −11 src/main/js/formatter/{color-test.js → color-test.ts}
  105. +7 −9 src/main/js/formatter/{color.js → color.ts}
  106. +0 −2 src/main/js/formatter/{formatter.js → formatter.ts}
  107. +1 −3 src/main/js/formatter/{number-test.js → number-test.ts}
  108. +3 −5 src/main/js/formatter/{number.js → number.ts}
  109. +2 −4 src/main/js/formatter/{string.js → string.ts}
  110. +0 −1 src/main/js/index.js
  111. +8 −10 src/main/js/{tweakpane.js → index.ts}
  112. +3 −5 src/main/js/misc/{class-name.js → class-name.ts}
  113. +10 −12 src/main/js/misc/{color-model-test.js → color-model-test.ts}
  114. +16 −6 src/main/js/misc/{color-model.js → color-model.ts}
  115. +7 −11 src/main/js/misc/{dom-util.js → dom-util.ts}
  116. +2 −4 src/main/js/misc/{emitter-test.js → emitter-test.ts}
  117. +0 −48 src/main/js/misc/emitter.js
  118. +48 −0 src/main/js/misc/emitter.ts
  119. +0 −21 src/main/js/misc/flow-util.js
  120. +13 −5 src/main/js/misc/{number-util-test.js → number-util-test.ts}
  121. +4 −6 src/main/js/misc/{number-util.js → number-util.ts}
  122. +1 −3 src/main/js/misc/{pane-error-test.js → pane-error-test.ts}
  123. +10 −12 src/main/js/misc/{pane-error.js → pane-error.ts}
  124. +23 −25 src/main/js/misc/{pointer-handler.js → pointer-handler.ts}
  125. +1 −6 src/main/js/misc/{test-util.js → test-util.ts}
  126. +0 −58 src/main/js/misc/ticker/interval.js
  127. +66 −0 src/main/js/misc/ticker/interval.ts
  128. +3 −5 src/main/js/misc/ticker/{manual.js → manual.ts}
  129. +1 −3 src/main/js/misc/ticker/{ticker.js → ticker.ts}
  130. +25 −0 src/main/js/misc/type-util.ts
  131. +3 −5 src/main/js/model/{button.js → button.ts}
  132. +3 −5 src/main/js/model/{color-test.js → color-test.ts}
  133. +11 −11 src/main/js/model/{color.js → color.ts}
  134. +1 −3 src/main/js/model/{foldable-test.js → foldable-test.ts}
  135. +3 −5 src/main/js/model/{foldable.js → foldable.ts}
  136. +7 −9 src/main/js/model/{folder.js → folder.ts}
  137. +1 −3 src/main/js/model/{graph-cursor-test.js → graph-cursor-test.ts}
  138. +3 −5 src/main/js/model/{graph-cursor.js → graph-cursor.ts}
  139. +11 −16 src/main/js/model/{input-value.js → input-value.ts}
  140. +3 −5 src/main/js/model/{list.js → list.ts}
  141. +4 −6 src/main/js/model/{monitor-value.js → monitor-value.ts}
  142. +1 −3 src/main/js/model/{target-test.js → target-test.ts}
  143. +0 −31 src/main/js/model/target.js
  144. +29 −0 src/main/js/model/target.ts
  145. +5 −7 src/main/js/parser/{color-test.js → color-test.ts}
  146. +6 −9 src/main/js/parser/{color.js → color.ts}
  147. +1 −3 src/main/js/parser/{number-test.js → number-test.ts}
  148. +2 −4 src/main/js/parser/{number.js → number.ts}
  149. +0 −3 src/main/js/parser/parser.js
  150. +1 −0 src/main/js/parser/parser.ts
  151. +5 −7 src/main/js/view/{button.js → button.ts}
  152. +12 −14 src/main/js/view/{folder.js → folder.ts}
  153. +9 −11 src/main/js/view/input/{checkbox.js → checkbox.ts}
  154. +21 −23 src/main/js/view/input/{color-picker.js → color-picker.ts}
  155. +8 −10 src/main/js/view/input/{color-swatch-text.js → color-swatch-text.ts}
  156. +12 −14 src/main/js/view/input/{color-swatch.js → color-swatch.ts}
  157. +9 −11 src/main/js/view/input/{h-palette.js → h-palette.ts}
  158. +1 −3 src/main/js/view/input/{input.js → input.ts}
  159. +13 −15 src/main/js/view/input/{list.js → list.ts}
  160. +8 −10 src/main/js/view/input/{slider-text.js → slider-text.ts}
  161. +14 −16 src/main/js/view/input/{slider.js → slider.ts}
  162. +9 −11 src/main/js/view/input/{sv-palette.js → sv-palette.ts}
  163. +12 −14 src/main/js/view/input/{text.js → text.ts}
  164. +5 −7 src/main/js/view/{labeled.js → labeled.ts}
  165. +9 −11 src/main/js/view/monitor/{color-swatch.js → color-swatch.ts}
  166. +24 −26 src/main/js/view/monitor/{graph.js → graph.ts}
  167. +1 −3 src/main/js/view/monitor/{monitor.js → monitor.ts}
  168. +12 −14 src/main/js/view/monitor/{multi-log.js → multi-log.ts}
  169. +12 −14 src/main/js/view/monitor/{single-log.js → single-log.ts}
  170. +11 −13 src/main/js/view/{root.js → root.ts}
  171. +0 −2 src/main/js/view/{separator.js → separator.ts}
  172. +2 −4 src/main/js/view/{view.js → view.ts}
  173. +1 −0 test-require/.npmrc
  174. +13 −0 test-require/index.js
  175. +14 −0 test-require/package.json
  176. +11 −0 tsconfig.json
  177. +20 −0 tslint.json
  178. +6 −6 webpack-doc.config.js
  179. +5 −4 webpack.config.js

This file was deleted.

Oops, something went wrong.
@@ -4,7 +4,7 @@ root = true
indent_size = 2
indent_style = tab

[*.{js,json}]
[*.{js,json,ts}]
indent_size = 2
indent_style = tab

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -14,24 +14,24 @@
"dist"
],
"scripts": {
"build": "run-s main:build doc:build",
"clean": "rm -rf dist docs tweakpane-*.tgz tweakpane-*.zip",
"dev": "npm-run-all main:build:dev doc:build --parallel main:watch doc:watch doc:server",
"format": "run-p main:format doc:format",
"prepare": "run-s clean main:prepare",
"prepublishOnly": "npm test",
"test": "run-s doc:test main:test",
"build": "run-s main:build doc:build",
"clean": "rm -rf dist docs test tweakpane-*.tgz tweakpane-*.zip",
"dev": "npm-run-all main:build:dev doc:build --parallel main:watch doc:watch doc:server",
"format": "run-p main:format doc:format",
"doc:build": "run-p doc:build:*",
"doc:build:css": "mkdir -p docs/assets && node-sass src/doc/sass/bundle.scss | postcss --config postcss.config.js > docs/assets/bundle.css",
"doc:build:html": "node project/render-html-templates.js",
"doc:build:js": "webpack --config webpack-doc.config.js",
"doc:checkFormat": "run-p doc:checkFormat:*",
"doc:checkFormat:css": "prettier --parser scss --list-different 'src/doc/sass/**/*.scss'",
"doc:checkFormat:js": "prettier --parser flow --list-different 'src/doc/js/**/*.js'",
"doc:checkFormat:js": "prettier --parser typescript --list-different 'src/doc/js/**/*.ts'",
"doc:format": "run-p doc:format:*",
"doc:format:css": "prettier --parser scss --write 'src/doc/sass/**/*.scss'",
"doc:format:js": "prettier --parser flow --write 'src/doc/js/**/*.js'",
"doc:lint:js": "eslint 'src/doc/js/**/*'",
"doc:format:js": "prettier --parser typescript --write 'src/doc/js/**/*.ts'",
"doc:lint:js": "tslint --project tsconfig.json 'src/doc/js/**/*'",
"doc:server": "http-server ./docs",
"doc:test": "run-s doc:lint:js doc:checkFormat",
"doc:watch": "run-p doc:watch:*",
@@ -43,33 +43,27 @@
"main:build:prod": "webpack --mode production",
"main:checkFormat": "run-p main:checkFormat:*",
"main:checkFormat:css": "prettier --parser scss --list-different 'src/main/sass/**/*.scss'",
"main:checkFormat:js": "prettier --parser flow --list-different 'src/main/js/**/*.js'",
"main:flow": "flow --show-all-errors",
"main:checkFormat:js": "prettier --parser typescript --list-different 'src/main/js/**/*.ts'",
"main:format": "run-p main:format:*",
"main:format:css": "prettier --parser scss --write 'src/main/sass/**/*.scss'",
"main:format:js": "prettier --parser flow --write 'src/main/js/**/*.js'",
"main:lint:js": "eslint 'src/main/js/**/*'",
"main:format:js": "prettier --parser typescript --write 'src/main/js/**/*.ts'",
"main:lint:js": "tslint --project tsconfig.json 'src/main/js/**/*'",
"main:prepare": "npm-run-all main:build --serial main:release:dist",
"main:release": "npm-run-all clean main:build --serial main:release:dist main:release:version main:release:zip",
"main:release:dist": "mkdir -p dist && cp docs/assets/tweakpane*.js dist",
"main:release:version": "node project/add-version-postfix.js",
"main:release:zip": "zip -j -r tweakpane-$(cat package.json | npx json version).zip dist",
"main:test": "run-s main:checkFormat main:flow main:lint:js main:test:js",
"main:test": "run-s main:checkFormat main:lint:js main:test:js main:test:require",
"main:test:coverage": "nyc report --reporter=html --reporter=text --reporter=lcovonly --report-dir=test/coverage",
"main:test:coveralls": "nyc report --reporter=text-lcov | coveralls",
"main:test:js": "nyc mocha --require @babel/register 'src/main/js/**/*-test.js'",
"main:test:report": "nyc mocha --require @babel/register --reporter mocha-junit-reporter --reporter-options mochaFile=./test/results/results.xml 'src/main/js/**/*-test.js'",
"main:test:js": "nyc --extension '.ts' mocha --require ts-node/register 'src/main/js/**/*-test.ts'",
"main:test:report": "nyc --extension '.ts' mocha --require ts-node/register --reporter mocha-junit-reporter --reporter-options mochaFile=./test/results/results.xml 'src/main/js/**/*-test.ts'",
"main:test:require": "npm run main:prepare && (cd test-require && npm run try)",
"main:watch": "webpack --mode development --watch"
},
"dependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"autoprefixer": "^9.1.5",
"babel-loader": "^8.0.4",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"awesome-typescript-loader": "^5.2.1",
"css-loader": "^1.0.0",
"fs-extra": "^7.0.0",
"glob": "^7.1.3",
@@ -79,17 +73,17 @@
"postcss-cli": "^6.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"typescript": "^3.2.2",
"webpack": "^4.23.1"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/register": "^7.0.0",
"babel-eslint": "^10.0.1",
"@types/chai": "^4.1.7",
"@types/jsdom": "^12.2.0",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.18",
"@types/pixi.js": "^4.8.6",
"chai": "^4.2.0",
"coveralls": "^3.0.2",
"eslint": "^5.7.0",
"eslint-plugin-flowtype": "^2.50.3",
"flow-bin": "^0.85.0",
"http-server": "^0.11.1",
"jsdom": "^12.2.0",
"json": "^9.0.6",
@@ -98,6 +92,8 @@
"nyc": "^13.1.0",
"onchange": "^5.0.2",
"prettier": "^1.15.3",
"ts-node": "^7.0.1",
"tslint": "^5.12.0",
"webpack-cli": "^3.1.2"
}
}
@@ -1,5 +1,3 @@
// @flow

import IndexRoute from './route/index';
import InputRoute from './route/input';
import MiscRoute from './route/misc';
@@ -17,7 +15,9 @@ declare var Tweakpane: any;
router.add(MonitorRoute);
router.route(location.pathname);

const markElem = document.querySelector('.common-logo_symbol');
const markElem: HTMLElement | null = document.querySelector(
'.common-logo_symbol',
);
if (markElem) {
window.addEventListener('scroll', () => {
const angle = window.scrollY * 0.5;
@@ -1,15 +1,14 @@
// @flow

import Sketch from '../sketch';
import * as Util from '../util';

import type {Environment} from '../sketch';
import {Environment} from '../sketch';

declare var Tweakpane: any;

export default {
pathname: /^(\/tweakpane)?\/$/,
init() {

init: () => {
const ENV: Environment = {
color: '#e4e4e7',
maxSize: 64,
@@ -23,7 +22,7 @@ export default {
yfreq: 2 * Math.PI,
};

const PRESETS: {[string]: Environment} = {
const PRESETS: {[key: string]: Environment} = {
atmos: {
color: '#e4e4e7',
maxSize: 128,
@@ -75,10 +74,12 @@ export default {
}
const sketch = new Sketch(sketchElem, ENV);

const markerToFnMap = {
index(container) {
const markerToFnMap: {
[key: string]: (container: HTMLElement | null) => void;
} = {
index: (container) => {
const pane = new Tweakpane({
container,
container: container,
title: 'Tweakpane',
});
pane.addInput(ENV, 'title').on('change', (value: string) => {
@@ -136,6 +137,7 @@ export default {
label: 'preset',
options: {
'Import...': '',

Atmos: 'atmos',
Bubble: 'bubble',
Cloud: 'cloud',
@@ -169,10 +171,11 @@ export default {
}, 200);
});
},
first(container) {

first: (container) => {
const PARAMS = {speed: 0.5};
const pane = new Tweakpane({
container,
container: container,
});

const updatePreset = () => {
Oops, something went wrong.

0 comments on commit 0763430

Please sign in to comment.