Skip to content

Commit

Permalink
v1.0.0 release (#139)
Browse files Browse the repository at this point in the history
Clean up deprecated methods.

Renamed methods:
* defineMode() => useMode();
* getModeDefinition() => getMode();

Changes in color space definition:
* input{} => fromMode{}
* output{} => toMode{}
* parsers[] => parse[]
* serialize: don't include the awkward "color(" part

Make culori tree-shakeable, fixes #143. Culori now provides three flavors:
* 'culori' — full library, with all color spaces pre-registered;
* 'culori/css' — with just the css-color-4-related color spaces;
* 'culori/fn' - tree-shakeable collection of functions, no color spaces pre-registered.
  • Loading branch information
danburzo authored Oct 1, 2021
1 parent b7f1f88 commit 9010294
Show file tree
Hide file tree
Showing 74 changed files with 2,749 additions and 3,942 deletions.
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:import/recommended"],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["import"],
"rules": {
"constructor-super": 1,
"import/no-anonymous-default-export": 1,
"import/no-unused-modules": 1,
"no-const-assign": 1,
"no-mixed-spaces-and-tabs": 0,
"no-this-before-super": 1,
"no-undef": 2,
"no-unused-vars": [1, { "args": "none" }],
"valid-typeof": 1
}
}
2 changes: 2 additions & 0 deletions .git-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
npx pretty-quick --staged
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.md
84 changes: 84 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { build } from 'esbuild';

// Bundled CJS
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
format: 'cjs',
outfile: 'bundled/culori.cjs'
});

// Bundled CJS, minified
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
minify: true,
format: 'cjs',
outfile: 'bundled/culori.min.cjs'
});

// Bundled ESM
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
format: 'esm',
outfile: 'bundled/culori.mjs'
});

// Bundled ESM, minified
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
minify: true,
format: 'esm',
outfile: 'bundled/culori.min.mjs'
});

// Bundled IIFE
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
format: 'iife',
globalName: 'culori',
outfile: 'bundled/culori.js'
});

// Bundled IIFE, minified
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
minify: true,
format: 'iife',
globalName: 'culori',
outfile: 'bundled/culori.min.js'
});

// Bundled UMD
// Adapted from: https://github.com/umdjs/umd/blob/master/templates/returnExports.js
build({
entryPoints: ['./src/index.js'],
logLevel: 'info',
bundle: true,
format: 'iife',
globalName: 'culori',
banner: {
js: `(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
root.culori = factory();
}
}
(typeof self !== 'undefined' ? self : this, function() {`
},
footer: { js: `return culori; }));` },
outfile: 'bundled/culori.umd.js'
});
2 changes: 1 addition & 1 deletion docs/_includes/layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>{{ title }}</h1>
</div>
{% include 'partials/footer.html' %}

<script src="https://unpkg.com/culori"></script>
<script src="https://unpkg.com/culori@{{ pkg.version }}"></script>
<script type="text/javascript">
document.body.style.setProperty(
'--random-1',
Expand Down
9 changes: 2 additions & 7 deletions docs/_includes/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
<footer>
<div class="container">
<p>
A <a href="https://labs.moqups.com">Moqups Labs</a> thing. Source
code available on
<a href="https://github.com/evercoder/culori">GitHub</a>.
</p>

<p>
Can this page be improved?
A <a href="https://labs.moqups.com">Moqups Labs</a> thing. Can this
page be improved?
<a
href="https://github.com/Evercoder/culori/blob/main/{{ page.inputPath }}"
>Edit it on GitHub</a
Expand Down
10 changes: 8 additions & 2 deletions docs/_includes/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
</div>
<nav>
<ul>
{%- for post in (collections.all | sortby('menu-order')) -%}
{%- for post in (collections.all | sortby('menu-order')) -%} {%
if post.data['menu-order'] %}
<li class="{% if page.url == post.url %}active {% endif %}">
<a href="{{ post.url }}">{{ post.data.title }}</a>
</li>
{%- endfor -%}
{% endif %} {%- endfor -%}
<li>
<a href="https://github.com/Evercoder/culori"
>GitHub <span aria-hidden="true"></span></a
>
</li>
</ul>
</nav>
</div>
Expand Down
Loading

0 comments on commit 9010294

Please sign in to comment.