Skip to content

Commit

Permalink
v10.2.4 => Release Notes for details resolves #256
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekRaafat committed Jul 7, 2021
1 parent 9fd1b16 commit df24f24
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ autoComplete.js is a simple, pure vanilla Javascript library progressively desig
`JS`

```html
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].2/dist/autoComplete.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/autoComplete.min.js"></script>
```

`CSS`

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].2/dist/css/autoComplete.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/css/autoComplete.min.css">
```
#### Package Manager

Expand Down
9 changes: 3 additions & 6 deletions dist/autoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,11 @@
}
});

var getData = function getData(ctx) {
var getData = function getData(ctx, query) {
return new Promise(function ($return, $error) {
var input, query, data;
input = ctx.input;
query = ctx.query;
var data;
data = ctx.data;
if (data.cache && data.store) return $return();
query = query ? query(input.value) : input.value;
return new Promise(function ($return, $error) {
if (typeof data.src === "function") {
return data.src(query).then($return, $error);
Expand Down Expand Up @@ -475,7 +472,7 @@
queryVal = ctx.query ? ctx.query(queryVal) : queryVal;
condition = checkTrigger(queryVal, ctx.trigger, ctx.threshold);
if (condition) {
return getData(ctx).then(function ($await_2) {
return getData(ctx, queryVal).then(function ($await_2) {
try {
if (ctx.feedback instanceof Error) return $return();
findMatches(queryVal, ctx);
Expand Down
Binary file modified dist/autoComplete.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/autoComplete.min.js

Large diffs are not rendered by default.

Binary file modified dist/autoComplete.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" type="text/css" media="screen"
href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].3/dist/css/autoComplete.min.css">
href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/css/autoComplete.min.css">
<!-- <link rel="stylesheet" type="text/css" media="screen" href="./css/autoComplete.css"> -->
<link rel="stylesheet" type="text/css" media="screen" href="./css/main.css">
<link href="https://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet">
Expand Down Expand Up @@ -150,7 +150,7 @@ <h4>mode</h4>
</div>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].3/dist/autoComplete.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/autoComplete.min.js"></script>
<!-- <script src="./js/autoComplete.js"></script> -->
<script src="./js/index.js"></script>
</body>
Expand Down
9 changes: 3 additions & 6 deletions docs/demo/js/autoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,11 @@
}
});

var getData = function getData(ctx) {
var getData = function getData(ctx, query) {
return new Promise(function ($return, $error) {
var input, query, data;
input = ctx.input;
query = ctx.query;
var data;
data = ctx.data;
if (data.cache && data.store) return $return();
query = query ? query(input.value) : input.value;
return new Promise(function ($return, $error) {
if (typeof data.src === "function") {
return data.src(query).then($return, $error);
Expand Down Expand Up @@ -475,7 +472,7 @@
queryVal = ctx.query ? ctx.query(queryVal) : queryVal;
condition = checkTrigger(queryVal, ctx.trigger, ctx.threshold);
if (condition) {
return getData(ctx).then(function ($await_2) {
return getData(ctx, queryVal).then(function ($await_2) {
try {
if (ctx.feedback instanceof Error) return $return();
findMatches(queryVal, ctx);
Expand Down
Binary file modified docs/demo/js/autoComplete.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/demo/js/autoComplete.min.js

Large diffs are not rendered by default.

Binary file modified docs/demo/js/autoComplete.min.js.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
src="//platform-api.sharethis.com/js/sharethis.js#property=5c213660c276020011d38212&product=inline-share-buttons"
async="async"></script>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].3/dist/css/autoComplete.min.css">
href="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/css/autoComplete.min.css">
</head>

<body>
Expand Down Expand Up @@ -209,7 +209,7 @@
mustache: {
data: ["../package.json", {
minVersion: "10.2",
version: "10.2.3"
version: "10.2.4"
}]
}
}
Expand All @@ -224,7 +224,7 @@
<script src="https://cdn.jsdelivr.net/npm/docsify-example-panels"></script>
<script src="//cdn.jsdelivr.net/npm/codeblock-iframe@latest/dist/index.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-codeblock-iframe@latest/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].3/dist/autoComplete.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected].4/dist/autoComplete.min.js"></script>
</body>

</html>
5 changes: 4 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ For more information on semantic versioning, please visit <http://semver.org/>.

***

### v10.2.3 ✨
### v10.2.4 ✨
- 🎛️ Updated: Library code with minor optimizations (Thanks 👍 @folknor) #256

### v10.2.3
- 🔧 Fixed: `query` API issue (Thanks 👍 @folknor) #254

### v10.2.2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "10.2.3",
"version": "10.2.4",
"name": "@tarekraafat/autocomplete.js",
"description": "Simple autocomplete pure vanilla Javascript library.",
"keywords": [
Expand Down
6 changes: 2 additions & 4 deletions src/controllers/dataController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import search from "./searchController";
*
* @param {Object} ctx - autoComplete.js context
*/
const getData = async (ctx) => {
let { input, query, data } = ctx;
const getData = async (ctx, query) => {
const { data } = ctx;

if (data.cache && data.store) return;

query = query ? query(input.value) : input.value;

ctx.feedback = data.store = typeof data.src === "function" ? await data.src(query) : data.src;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/listController.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const feedback = (ctx, index) => {
* @param {Object} ctx - autoComplete.js context
*/
const render = (ctx) => {
let { resultsList, list, resultItem, feedback } = ctx;
const { resultsList, list, resultItem, feedback } = ctx;
const { matches, results } = feedback;

// Reset cursor
Expand Down
2 changes: 1 addition & 1 deletion src/services/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import eventEmitter from "../helpers/eventEmitter";
* @param {Object} ctx - autoComplete.js context
*/
export default async function (ctx) {
let { placeHolder, resultsList } = ctx;
const { placeHolder, resultsList } = ctx;

const parentAttrs = {
role: "combobox",
Expand Down
2 changes: 1 addition & 1 deletion src/services/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function (ctx, q) {
// Validate trigger condition
if (condition) {
// Get from source
await getData(ctx);
await getData(ctx, queryVal);
// Check if data fetch failed
if (ctx.feedback instanceof Error) return;
// Find matching results to the query
Expand Down

0 comments on commit df24f24

Please sign in to comment.