Skip to content

Commit

Permalink
fix(components): remove faulty whitespace (algolia/vue-instantsearch#606
Browse files Browse the repository at this point in the history
)

* fix(components): remove faulty whitespace

If an inline element has whitespace, and then a text node, Vue will preserve this whitespace inside the component, and thus it will take up bundle size (a tiny little bit)

* chore(error): no newline

* chore(error): https
  • Loading branch information
Haroenv authored Jan 17, 2019
1 parent 9ca61ff commit a3f4908
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 72 deletions.
8 changes: 2 additions & 6 deletions packages/vue-instantsearch/src/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@
:href="state.createURL(item.value)"
:class="suit('link')"
@click.prevent="state.refine(item.value)"
>
{{ item.name }}
</a>
<span v-else>
{{ item.name }}
</span>
>{{ item.name }}</a>
<span v-else>{{ item.name }}</span>
</li>
</ul>
</slot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
:disabled="!canRefine"
@click.prevent="state.refine"
>
<slot name="resetLabel">
Clear refinements
</slot>
<slot name="resetLabel">Clear refinements</slot>
</button>
</slot>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
<slot
name="showMoreLabel"
:is-showing-more="isShowingMore"
>
{{ isShowingMore ? 'Show less' : 'Show more' }}
</slot>
>{{ isShowingMore ? 'Show less' : 'Show more' }}</slot>
</button>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/Hits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
name="item"
:item="item"
:index="itemIndex"
>
objectID: {{ item.objectID }}, index: {{ itemIndex }}
</slot>
>objectID: {{ item.objectID }}, index: {{ itemIndex }}</slot>
</li>
</ol>
</slot>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/HitsPerPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
:key="item.value"
:class="suit('option')"
:value="item.value"
>
{{ item.label }}
</option>
>{{ item.label }}</option>
</select>
</slot>
</div>
Expand Down
8 changes: 2 additions & 6 deletions packages/vue-instantsearch/src/components/InfiniteHits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
name="item"
:item="item"
:index="index"
>
objectID: {{ item.objectID }}, index: {{ index }}
</slot>
>objectID: {{ item.objectID }}, index: {{ index }}</slot>
</li>
</ol>

Expand All @@ -35,9 +33,7 @@
:class="[suit('loadMore'), state.isLastPage && suit('loadMore', 'disabled')]"
:disabled="state.isLastPage"
@click="refine"
>
Show more results
</button>
>Show more results</button>
</slot>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
<slot
name="showMoreLabel"
:is-showing-more="state.isShowingMore"
>
{{ state.isShowingMore ? 'Show less' : 'Show more' }}
</slot>
>{{ state.isShowingMore ? 'Show less' : 'Show more' }}</slot>
</button>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/MenuSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
<slot
name="item"
:item="item"
>
{{ item.label }} ({{ item.count }})
</slot>
>{{ item.label }} ({{ item.count }})</slot>
</option>
</select>
</slot>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/NumericMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
:checked="item.isRefined"
@change="state.refine($event.target.value)"
>
<span :class="suit('labelText')">
{{ item.label }}
</span>
<span :class="suit('labelText')">{{ item.label }}</span>
</label>
</li>
</ul>
Expand Down
24 changes: 6 additions & 18 deletions packages/vue-instantsearch/src/components/Pagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
<span
:class="suit('link')"
aria-label="First"
>
‹‹
</span>
>‹‹</span>
</template>
</slot>
</li>
Expand All @@ -66,17 +64,13 @@
aria-label="Previous"
:href="state.createURL(state.currentRefinement - 1)"
@click.prevent="refine(state.currentRefinement - 1)"
>
</a>
>‹</a>
</template>
<template v-else>
<span
:class="suit('link')"
aria-label="Previous"
>
</span>
>‹</span>
</template>
</slot>
</li>
Expand All @@ -101,9 +95,7 @@
:class="suit('link')"
:href="state.createURL(page)"
@click.prevent="refine(page)"
>
{{ page + 1 }}
</a>
>{{ page + 1 }}</a>
</slot>
</li>

Expand Down Expand Up @@ -133,9 +125,7 @@
<span
:class="suit('link')"
aria-label="Next"
>
</span>
>›</span>
</template>
</slot>
</li>
Expand Down Expand Up @@ -165,9 +155,7 @@
<span
:class="suit('link')"
aria-label="Last"
>
››
</span>
>››</span>
</template>
</slot>
</li>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/RatingMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@
>
<slot name="andUp">&amp; Up</slot>
</span>
<span :class="suit('count')">
{{ item.count }}
</span>
<span :class="suit('count')">{{ item.count }}</span>
</a>
</li>
</ul>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/RefinementList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@
<slot
name="showMoreLabel"
:is-showing-more="state.isShowingMore"
>
Show {{ state.isShowingMore ? 'less' : 'more' }}
</slot>
>Show {{ state.isShowingMore ? 'less' : 'more' }}</slot>
</button>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/SortBy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
:class="suit('option')"
:value="item.value"
:selected="item.value === state.currentRefinement"
>
{{ item.label }}
</option>
>{{ item.label }}</option>
</select>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/components/Stats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
v-bind="state"
:results="state.instantSearchInstance.helper.lastResults"
>
<span :class="suit('text')">
{{ state.nbHits.toLocaleString() }} results found in {{ state.processingTimeMS.toLocaleString() }}ms
</span>
<span :class="suit('text')">{{ state.nbHits.toLocaleString() }} results found in {{ state.processingTimeMS.toLocaleString() }}ms</span>
</slot>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
:checked="state.value.isRefined"
@change="state.refine(state.value)"
>
<span :class="suit('labelText')">
{{ state.value.name }}
</span>
<span :class="suit('labelText')">{{ state.value.name }}</span>
<span
v-if="state.value.count !== null"
:class="suit('count')"
>
{{ state.value.count.toLocaleString() }}
</span>
>{{ state.value.count.toLocaleString() }}</span>
</label>
</slot>
</div>
Expand Down
4 changes: 1 addition & 3 deletions packages/vue-instantsearch/src/mixins/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ it's not the recommended way of making custom components.
If you want to disable this message, pass { connector: true } to the mixin.
(TODO: update v2 link)
Read more on using connectors: https://community.algolia.com/vue-instantsearch/getting-started/custom-components.html
`
Read more on using connectors: https://alg.li/vue-custom`
);
}
},
Expand Down

0 comments on commit a3f4908

Please sign in to comment.