diff --git a/package.json b/package.json index 01fce83..e957a17 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "stylelint": "stylelint resources/assets/sass/**/*" }, "devDependencies": { + "@types/jquery": "^3.3.29", "bootstrap": "^4.3.1", "cal-heatmap": "^3.3.10", "chart.js": "^2.7.1", @@ -28,7 +29,12 @@ "sass-loader": "^7.1.0", "stylelint": "^9.10.1", "stylelint-config-recess-order": "^2.0.1", - "vue-template-compiler": "^2.6.6" + "ts-loader": "^6.0.1", + "typescript": "^3.4.5", + "vue": "^2.6.10", + "vue-class-component": "^7.1.0", + "vue-property-decorator": "^8.1.1", + "vue-template-compiler": "^2.6.10" }, "stylelint": { "extends": "stylelint-config-recess-order" @@ -39,6 +45,9 @@ } }, "lint-staged": { - "*.{css,scss}": ["stylelint --fix", "git add"] + "*.{css,scss}": [ + "stylelint --fix", + "git add" + ] } } diff --git a/resources/assets/js/checkin.js b/resources/assets/js/checkin.js deleted file mode 100644 index e68fc0c..0000000 --- a/resources/assets/js/checkin.js +++ /dev/null @@ -1,58 +0,0 @@ -function updateTags() { - $('input[name=tags]').val( - $('#tags') - .find('li') - .map(function () { - return $(this).data('value'); - }) - .get() - .join(' ') - ); -} - -function insertTag(value) { - $('
  • | x
  • ') - .data('value', value) - .children(':last-child') - .text(value) - .end() - .appendTo('#tags'); -} - -var initTags = $('input[name=tags]').val(); -if (initTags.trim() !== '') { - initTags.split(' ').forEach(function (value) { - insertTag(value); - }); -} - -$('#tagInput').on('keydown', function (ev) { - var $this = $(this); - if ($this.val().trim() !== '') { - switch (ev.key) { - case 'Tab': - case 'Enter': - case ' ': - if (ev.originalEvent.isComposing !== true) { - insertTag($this.val().trim()); - $this.val(''); - updateTags(); - } - ev.preventDefault(); - break; - } - } else if (ev.key === 'Enter') { - // 誤爆防止 - ev.preventDefault(); - } -}); - -$('#tags') - .on('click', 'li', function (ev) { - $(this).remove(); - updateTags(); - }) - .parent() - .on('click', function (ev) { - $('#tagInput').focus(); - }); \ No newline at end of file diff --git a/resources/assets/js/checkin.ts b/resources/assets/js/checkin.ts new file mode 100644 index 0000000..7e54285 --- /dev/null +++ b/resources/assets/js/checkin.ts @@ -0,0 +1,9 @@ +import Vue from 'vue'; +import TagInput from "./components/TagInput.vue"; + +new Vue({ + el: '#app', + components: { + TagInput + } +}); diff --git a/resources/assets/js/components/TagInput.vue b/resources/assets/js/components/TagInput.vue new file mode 100644 index 0000000..a2c1ff3 --- /dev/null +++ b/resources/assets/js/components/TagInput.vue @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/resources/assets/js/vue-shims.d.ts b/resources/assets/js/vue-shims.d.ts new file mode 100644 index 0000000..ad17f79 --- /dev/null +++ b/resources/assets/js/vue-shims.d.ts @@ -0,0 +1,4 @@ +declare module "*.vue" { + import Vue from "vue"; + export default Vue; +} \ No newline at end of file diff --git a/resources/views/ejaculation/checkin.blade.php b/resources/views/ejaculation/checkin.blade.php index 669b9cf..6355014 100644 --- a/resources/views/ejaculation/checkin.blade.php +++ b/resources/views/ejaculation/checkin.blade.php @@ -3,7 +3,7 @@ @section('title', 'チェックイン') @section('content') -
    +

    今致してる?


    @@ -38,12 +38,8 @@
    - -
    -
      - -
      + Tab, Enter, 半角スペースのいずれかで入力確定します。 diff --git a/resources/views/ejaculation/edit.blade.php b/resources/views/ejaculation/edit.blade.php index 8bae248..73b16d4 100644 --- a/resources/views/ejaculation/edit.blade.php +++ b/resources/views/ejaculation/edit.blade.php @@ -3,7 +3,7 @@ @section('title', 'チェックインの修正') @section('content') -
      +

      チェックインの修正


      @@ -39,12 +39,8 @@
      - -
      -
        - -
        + Tab, Enter, 半角スペースのいずれかで入力確定します。 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d2d1b2c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "sourceMap": true, + "target": "es5", + "module": "es2015", + "moduleResolution": "node", + "strict": true, + "experimentalDecorators": true + }, + "include": [ + "resources/assets/js/**/*" + ] +} \ No newline at end of file diff --git a/webpack.mix.js b/webpack.mix.js index 703398c..3532d8b 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -16,7 +16,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/home.js', 'public/js') .js('resources/assets/js/user/stats.js', 'public/js/user') .js('resources/assets/js/setting/privacy.js', 'public/js/setting') - .js('resources/assets/js/checkin.js', 'public/js') + .ts('resources/assets/js/checkin.ts', 'public/js') .sass('resources/assets/sass/app.scss', 'public/css') .autoload({ 'jquery': ['$', 'jQuery', 'window.jQuery'] diff --git a/yarn.lock b/yarn.lock index a9058b8..6d0830e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7830,6 +7830,11 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" +vue-class-component@^7.0.1, vue-class-component@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/vue-class-component/-/vue-class-component-7.1.0.tgz#b33efcb10e17236d684f70b1e96f1946ec793e87" + integrity sha512-G9152NzUkz0i0xTfhk0Afc8vzdXxDR1pfN4dTwE72cskkgJtdXfrKBkMfGvDuxUh35U500g5Ve4xL8PEGdWeHg== + vue-hot-reload-api@^2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.2.tgz#1fcc1495effe08a790909b46bf7b5c4cfeb6f21b" @@ -7846,6 +7851,13 @@ vue-loader@^15.4.2: vue-hot-reload-api "^2.3.0" vue-style-loader "^4.1.0" +vue-property-decorator@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-8.1.1.tgz#80dadbe5ffa0e7eb6a0ba0a07036365471a7d5ee" + integrity sha512-K+PUT17ZEMWyhrKZnl4Fc9qMyFpMcjVbZJBwx4BpA8BXfaspaTeFdoHuk1aywC/+4G86sxIr/5n4IQUQLecSWw== + dependencies: + vue-class-component "^7.0.1" + vue-style-loader@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8" @@ -7854,10 +7866,10 @@ vue-style-loader@^4.1.0: hash-sum "^1.0.2" loader-utils "^1.0.2" -vue-template-compiler@^2.6.6: - version "2.6.6" - resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.6.tgz#a807acbf3d51971d3721d75ecb1b927b517c1a02" - integrity sha512-OakxDGyrmMQViCjkakQFbDZlG0NibiOzpLauOfyCUVRQc9yPmTqpiz9nF0VeA+dFkXegetw0E5x65BFhhLXO0A== +vue-template-compiler@^2.6.10: + version "2.6.10" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz#323b4f3495f04faa3503337a82f5d6507799c9cc" + integrity sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg== dependencies: de-indent "^1.0.2" he "^1.1.0" @@ -7867,6 +7879,11 @@ vue-template-es2015-compiler@^1.8.2: resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.8.2.tgz#dd73e80ba58bb65dd7a8aa2aeef6089cf6116f2a" integrity sha512-cliV19VHLJqFUYbz/XeWXe5CO6guzwd0yrrqqp0bmjlMP3ZZULY7fu8RTC4+3lmHwo6ESVDHFDsvjB15hcR5IA== +vue@^2.6.10: + version "2.6.10" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" + integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== + watchpack@^1.5.0: version "1.6.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00"