Skip to content
This repository was archived by the owner on Feb 12, 2020. It is now read-only.

Commit 31772ce

Browse files
committed
initial commit
0 parents  commit 31772ce

20 files changed

+2791
-0
lines changed

.eslintrc.json

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": "eslint:recommended",
7+
"rules": {
8+
"capitalized-comments": [
9+
"error",
10+
"always",
11+
{
12+
"ignoreConsecutiveComments": true
13+
}
14+
],
15+
"comma-dangle": [
16+
"error", {
17+
"arrays": "always-multiline",
18+
"objects": "always-multiline",
19+
"imports": "never",
20+
"exports": "never",
21+
"functions": "never"
22+
}
23+
],
24+
"comma-spacing": "error",
25+
"curly": [
26+
"error",
27+
"multi-line"
28+
],
29+
"eol-last": "error",
30+
"eqeqeq": "error",
31+
"indent": [
32+
"error",
33+
"tab"
34+
],
35+
"keyword-spacing": "error",
36+
"linebreak-style": [
37+
"error",
38+
"unix"
39+
],
40+
"no-console": [
41+
"error",
42+
{
43+
"allow": ["warn", "error"]
44+
}
45+
],
46+
"no-eval": [
47+
"error",
48+
{
49+
"allowIndirect": true
50+
}
51+
],
52+
"no-redeclare": "error",
53+
"no-unused-vars": "warn",
54+
"no-useless-concat": "error",
55+
"one-var": [
56+
"error",
57+
"never"
58+
],
59+
"quote-props": [
60+
"error",
61+
"as-needed"
62+
],
63+
"quotes": [
64+
"error",
65+
"single"
66+
],
67+
"require-jsdoc": [
68+
"error", {
69+
"require": {
70+
"FunctionDeclaration": true,
71+
"MethodDefinition": true,
72+
"ClassDeclaration": false,
73+
"ArrowFunctionExpression": false,
74+
"FunctionExpression": true
75+
}
76+
}
77+
],
78+
"semi": [
79+
"error",
80+
"always"
81+
],
82+
"space-before-blocks": [
83+
"error",
84+
"always"
85+
],
86+
"space-before-function-paren": [
87+
"error",
88+
"never"
89+
],
90+
"spaced-comment": [
91+
"error",
92+
"always",
93+
{
94+
"line": {
95+
"markers": ["/"],
96+
"exceptions": ["-", "+"]
97+
},
98+
"block": {
99+
"markers": ["!"],
100+
"exceptions": ["*"],
101+
"balanced": true
102+
}
103+
}
104+
],
105+
"space-in-parens": [
106+
"error",
107+
"never"
108+
],
109+
"space-infix-ops": [
110+
"error",
111+
{
112+
"int32Hint": false
113+
}
114+
],
115+
"space-unary-ops": [
116+
"error",
117+
{
118+
"words": true,
119+
"nonwords": false,
120+
"overrides": {
121+
"new": false,
122+
"++": false
123+
}
124+
}
125+
],
126+
"valid-jsdoc": "error",
127+
"yoda": [
128+
"error",
129+
"always"
130+
]
131+
}
132+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules/
2+
/.sass-cache/
3+
/package-lock.json

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

README.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# vue-blob-select
2+
3+
vue-blob-select is a fork of [blob-select](https://github.com/Blobfolio/blob-select), reimagined as a [Vue.js](https://vuejs.org/) component.
4+
5+
Both plugins provide an easy way to style pesky `<select>` elements, emphasizing markup simplicity and performance. Both plugins, also, integrate perfectly well with Vue. (Though obviously, this one *only* works with Vue.)
6+
7+
So why the fork?
8+
9+
Because the original [blob-select](https://github.com/Blobfolio/blob-select) is dependency-free, it contains a lot of code that is redundant when a framework like Vue is also present. Cutting those bits out reduces the size of the Javascript by over 50%.
10+
11+
Hooking into the complex DOM capabilities of Vue also provide some runtime performance gains, particularly as applied to change detection and repainting.
12+
13+
14+
15+
##### Table of Contents
16+
17+
1. [Features](#features)
18+
2. [Requirements](#requirements)
19+
3. [Use](#use)
20+
* [Installation](#installation)
21+
* [Configuration](#configuration)
22+
4. [Styling](#styling)
23+
5. [License](#license)
24+
25+
26+
27+
&nbsp;
28+
29+
## Features
30+
31+
vue-blob-select has all the same features as [blob-select](https://github.com/Blobfolio/blob-select#features). For more details, check out that README.
32+
33+
34+
35+
&nbsp;
36+
37+
## Requirements
38+
39+
vue-blob-select is a Vue component, and as such requires [Vue.js](https://vuejs.org/). But other than that, there are no special dependencies.
40+
41+
It is compatible with all major modern web browsers, and ~~the browser that just won't die~~ IE 11.
42+
43+
This plugin does make use of some ES6 markup like `let` and `const`. If your project needs to support *old* browsers, you will need to first transpile `vue-blobselect.min.js` to ES5 with a tool like [Babel](https://babeljs.io/), then serve that copy to visitors.
44+
45+
46+
47+
&nbsp;
48+
49+
## Use
50+
51+
52+
### Installation
53+
54+
Grab a copy of `dist/vue-blobselect.min.js` and throw it onto the page:
55+
56+
```html
57+
<script src="/path/to/vue.min.js"></script>
58+
<script src="/path/to/vue-blobselect.min.js"></script>
59+
<script src="/path/to/your-vue-project.min.js"></script>
60+
```
61+
62+
If a global `window.Vue` exists, the component should self-register. Otherwise you can register it like any other component via something like:
63+
64+
```javascript
65+
import blobSelect from './vue-blobselect.min.js';
66+
Vue.component(blobSelect);
67+
```
68+
69+
The `dist/` folder also includes an example stylesheet and icon for the search bar to help get you started. Of course, you can also write styles from scratch; the generated markup is pretty straight-forward. :)
70+
71+
72+
73+
74+
### Configuration
75+
76+
While the features and eventual markup of this fork maintain full parity with [blob-select](https://github.com/Blobfolio/blob-select), the configuration for this plugin is handled in a more Vue-appropriate way.
77+
78+
```html
79+
<blob-select v-model="some.model" :any-props="some.value"></blob-select>
80+
```
81+
82+
In case it wasn't obvious, the component has bi-directional `model` support, so you can bind the `<select>` value to any Vue data you want. To treat values numerically, use `v-model.number="foo"` in combination with `value-type='number'`. Otherwise it's strings all the way down.
83+
84+
The following properties can be set on the component. To set them dynamically (to e.g. Vue data), prefix the field with a `:`, otherwise if passing a literal, just throw it in as any old attribute.
85+
86+
Any attributes not mentioned below will be copied to the `.blobselect` container. You can set classes in this way; they'll just be merged with the plugin's.
87+
88+
| Type | Key | Description | Default |
89+
| ---- | --- | ----------- | ------- |
90+
| *string* | **id** | An ID to apply to the true `<select>` field. | `"blobselect"` |
91+
| *string* | **name** | A name to apply to the true `<select>` field. | `"blobselect"` |
92+
| *array* | **items** | These are your `<option>`s. See below for more information. | `[]` |
93+
| *bool* | **disabled** | Disable the entire field. | `FALSE` |
94+
| *bool* | **multiple** | Mimic `[multiple]` behaviors. | `FALSE` |
95+
| *bool* | **placeholder** | Enable a placeholder-like null `<option>`. | `FALSE` |
96+
| *bool* | **required** | Mark the field required. | `FALSE` |
97+
| *bool* | **search** | Enable the search/filter bar. | `FALSE` |
98+
| *string* | **sort** | Sort items either `"ASC"` or `"DESC"`. | `""` (no sorting) |
99+
| *string* | **field-placeholder** | When **placeholder** is `TRUE` and no value is selected, this text will appear in the main field. | `"---"` |
100+
| *string* | **label-placeholder** | When **placeholder** is `TRUE`, a null `<option>` with this text will be added to the menu. | `"---"` |
101+
| *string* | **label-type** | If **sort** is enabled, you can set this to `"number"` to treat labels as numbers when sorting. | `"string"` |
102+
| *string* | **value-type** | Set this to `"number"` to treat values as numbers rathre than strings. If binding a model, also be sure to use the `.number` modifier. | `"string"` |
103+
104+
#### Items
105+
106+
Items (i.e. `<option>`s) should be passed as an `Array` via the `:items="[…]"` attribute on the component.
107+
108+
Each item — an element of the items array — can be either a simple, flat value like `"foo"`, or an object specifying that item's properties.
109+
110+
For flat items, the value and label will be the same, e.g. `<option value="foo">foo</option>`.
111+
112+
The following settings can be specified for any item defined as an object:
113+
114+
| Type | Key | Description | Default |
115+
| ---- | --- | ----------- | ------- |
116+
| *string* | **group** | A group label to mimic `<optgroup>` suborganization. | `""` |
117+
| *mixed* | **label** | The item label. The data type should match the main **label-type** property. | `""` or `0` |
118+
| *mixed* | **value** | The item value. The data type should match the main **value-type** property. | `""` or `0` |
119+
| *bool* | **disabled** | Mark the item disabled. If the component itself is disabled, this setting has no effect. | `FALSE` |
120+
121+
To see an example, check out `src/demo.html`.
122+
123+
124+
125+
&nbsp;
126+
127+
## Styling
128+
129+
The markup resulting from vue-blob-select is identical to that generated by the original [blob-select](https://github.com/Blobfolio/blob-select#styling). For more details, check out that README.
130+
131+
Otherwise the SCSS source folder includes example styles to get you started.
132+
133+
134+
135+
&nbsp;
136+
137+
## License
138+
139+
Copyright © 2018 [Blobfolio, LLC](https://blobfolio.com) &lt;hello@blobfolio.com&gt;
140+
141+
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2.
142+
143+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
144+
Version 2, December 2004
145+
146+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
147+
148+
Everyone is permitted to copy and distribute verbatim or modified
149+
copies of this license document, and changing it is allowed as long
150+
as the name is changed.
151+
152+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
153+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
154+
155+
0. You just DO WHAT THE FUCK YOU WANT TO.
156+
157+
### Donations
158+
159+
<table>
160+
<tbody>
161+
<tr>
162+
<td width="200"><img src="https://blobfolio.com/wp-content/themes/b3/svg/btc-github.svg" width="200" height="200" alt="Bitcoin QR" /></td>
163+
<td width="450">If you have found this work useful and would like to contribute financially, Bitcoin tips are always welcome!<br /><br /><strong>1Af56Nxauv8M1ChyQxtBe1yvdp2jtaB1GF</strong></td>
164+
</tr>
165+
</tbody>
166+
</table>

dist/css/blobselect.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/img/search.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)