diff --git a/package-lock.json b/package-lock.json index 7a8713f..3afb90c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -521,6 +521,19 @@ "@types/node": "*" } }, + "@vue/reactivity": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz", + "integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==", + "requires": { + "@vue/shared": "3.1.5" + } + }, + "@vue/shared": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz", + "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==" + }, "a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -584,6 +597,14 @@ "uri-js": "^4.2.2" } }, + "alpinejs": { + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.10.2.tgz", + "integrity": "sha512-P6DTX78J94FgsskS3eS23s26hfb0NWQZUidBnkUK7fId1x64/kLm5E79lL3HNItUmHDCKOHvfP8EAcuCVab89w==", + "requires": { + "@vue/reactivity": "~3.1.1" + } + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -2882,6 +2903,11 @@ "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true }, + "fuse.js": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz", + "integrity": "sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA==" + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", diff --git a/package.json b/package.json index 411e271..6561859 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,8 @@ "stylelint-config-standard": "^25.0.0", "tailwindcss": "^3.0.24" }, - "dependencies": {} + "dependencies": { + "alpinejs": "^3.10.2", + "fuse.js": "^6.6.2" + } } diff --git a/src/js/index.js b/src/js/index.js index e69de29..8563a40 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -0,0 +1,7 @@ +import Alpine from 'alpinejs' +import Fuse from 'fuse.js' + +window.Fuse = Fuse +window.Alpine = Alpine + +Alpine.start() diff --git a/src/pages/index.njk b/src/pages/index.njk index cc605c2..6034906 100644 --- a/src/pages/index.njk +++ b/src/pages/index.njk @@ -4,5 +4,53 @@
-

Привет мир!

+
+
+ +
+
    + + +
+
+
+
\ No newline at end of file diff --git a/src/pages/search-index.11tydata.js b/src/pages/search-index.11tydata.js new file mode 100644 index 0000000..0f8f503 --- /dev/null +++ b/src/pages/search-index.11tydata.js @@ -0,0 +1,16 @@ +module.exports = { + permalink: '/search-index.json', + + eleventyComputed: { + notes: function (data) { + return data.collections.notes.map((x) => { + const pathName = x.filePathStem.replace('index', '') + + return { + title: x.data.title, + url: pathName + } + }) + } + } +} diff --git a/src/pages/search-index.njk b/src/pages/search-index.njk new file mode 100644 index 0000000..9abc3ee --- /dev/null +++ b/src/pages/search-index.njk @@ -0,0 +1,7 @@ +[ + {% for note in notes %} + { + "title":"{{ note.title }}", + "url":"{{ note.url | url }}" + }{% if loop.last == false %},{% endif %} {% endfor %} +] \ No newline at end of file