progress on migrating to heex templates and font-icons

This commit is contained in:
Adam Piontek 2022-08-13 07:32:36 -04:00
parent d43daafdb7
commit 3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/url-slug

2
assets_old/node_modules/url-slug/.npmignore generated vendored Normal file
View file

@ -0,0 +1,2 @@
.DS_Store
node_modules

92
assets_old/node_modules/url-slug/README.md generated vendored Normal file
View file

@ -0,0 +1,92 @@
# url-slug
RFC 3986 compliant slug generator with support for multiple languages. It creates safe slugs for use in urls—and can revert them.
## Install
```bash
$ npm install url-slug
```
## Use
```js
var urlSlug = require('url-slug');
// Convert to common slug format, using defaults
urlSlug('Sir James Paul McCartney MBE is an English singer-songwriter');
// sir-james-paul-mc-cartney-mbe-is-an-english-singer-songwriter
// Uppercase with default separator
urlSlug('Comfortably Numb', null, 'uppercase');
// COMFORTABLY-NUMB
// Use an underscore separator and don't touch the string case
urlSlug('á é í ó ú Á É Í Ó Ú ç Ç æ Æ œ Œ ® © € ¥ ª º ¹ ² ½ ¼', '_', false);
// a_e_i_o_u_A_E_I_O_U_c_C_ae_AE_oe_OE_r_c_EU_Y_a_o_1_2_1_2_1_4
// Titlecased without a separator
urlSlug('Red, red wine, stay close to me…', '', 'titlecase');
// RedRedWineStayCloseToMe
// Use a custom separator and uppercase the string (the separator '.' was ignored, because spaces were replaced)
urlSlug('O\'Neill is an American surfboard, surfwear and equipment brand', '.', function (sentence) {
return sentence.replace(/ /g, '+').toUpperCase();
});
// O+NEILL+IS+AN+AMERICAN+SURFBOARD+SURFWEAR+AND+EQUIPMENT+BRAND
// Automatic reversion of slugs
urlSlug.revert('Replace-every_separator.allowed~andSplitCamelCase');
// Replace every separator allowed and Split Camel Case
// Precise reversion, setting the separator and converting the sentence to title case
urlSlug.revert('this-title-needs-a-title_case', '-', 'titlecase');
// This Title Needs A Title_case
// Create a new instance with its own defaults
var custom = new urlSlug.UrlSlug('~', 'uppercase');
custom.convert('Listen to Fito Páez in Madrid');
// LISTEN~TO~FITO~PAEZ~IN~MADRID
```
## Know
### urlSlug(string[, separator, transform]), UrlSlug.convert(string[, separator, transform])
Converts a sentence into a slug.
- __separator__, defaults to `'-'` — can be any of `'-._~'` characters or an empty string; a `null` or `undefined` value will set the default separator
- __transform__, defaults to `'lowercase'` — can be `'lowercase'`, `'uppercase'`, `'titlecase'` or a custom function; if set to `false`, no transform will take place; a `null` or `undefined` value will set the default transform
### UrlSlug.revert(string[, separator, transform])
Reverts a slug back to a sentence.
- __separator__, defaults to `null` — can be any of `'-._~'` characters or an empty string; a `null` or `undefined` will set to match all possible separator characters and camel case occurrences; an empty string will set to match only camel case occurrences
- __transform__, defaults to `null` — can be `'lowercase'`, `'uppercase'`, `'titlecase'` or a custom function; if set to `false`, `null` or `undefined` no transform will take place
### urlSlug.UrlSlug([separator, transform])
url-slug constructor, use this if you need another instance. If __separator__ or __transform__ are set, they will be used as the default values of the instance.
- __separator__, defaults to `'-'`
- __transform__, defaults to `'lowercase'`
### Builtin transformers
- __UrlSlug.transformers.lowercase__ — lower case
- __UrlSlug.transformers.uppercase__ — UPPER CASE
- __UrlSlug.transformers.titlecase__ — Title Case
## TODO
- Option to keep specific characters

148
assets_old/node_modules/url-slug/index.js generated vendored Normal file
View file

@ -0,0 +1,148 @@
const unidecode = require('unidecode');
const INVALID_SEPARATOR_REGEXP = /[^-._~]/;
const TITLE_CASE_REGEXP = /(?:^| )[a-z]/g;
const CONVERT_REGEXP = /[^A-Za-z0-9]+|([a-z])([A-Z])/g;
const CONVERT_SEPARATOR_REGEXP = / /g;
const REVERT_REGEXP = {}; /* RegExp intances are based on the separator and then cached */
const REVERT_AUTO_REGEXP = /[-._~]+|([a-z])([A-Z])/g;
const REVERT_CAMEL_CASE_REGEXP = /([a-z])([A-Z])/g;
/**
* Creates a new instance of url-slug
*/
function UrlSlug(separator, transform) {
/* Set defaults */
separator = null == separator ? '-' : separator;
transform = null == transform ? 'lowercase' : transform;
/* Validate through prepare method */
var options = this.prepare(separator, transform);
this.separator = options.separator;
this.transform = options.transform;
}
/**
* Builtin transformers
*/
UrlSlug.prototype.transformers = {
lowercase: function (string) {
return string.toLowerCase();
},
uppercase: function (string) {
return string.toUpperCase();
},
titlecase: function (string) {
return string.toLowerCase().replace(TITLE_CASE_REGEXP, function (character) {
return character.toUpperCase();
});
},
};
/**
* Check and return validated options
*/
UrlSlug.prototype.prepare = function (separator, transform) {
if (null == separator) {
separator = this.separator;
} else if ('string' !== typeof separator) {
throw new Error('Invalid separator, must be a string: "' + separator + '".');
} else if (INVALID_SEPARATOR_REGEXP.test(separator)) {
throw new Error('Invalid separator, has invalid characters: "' + separator + '".');
}
if (null == transform) {
transform = this.transform;
} else if (false === transform) {
transform = false;
} else if (this.transformers[transform]) {
transform = this.transformers[transform];
} else if ('function' !== typeof transform) {
throw new Error('Invalid transform, must be a builtin transform or a function: "' + transform + '".');
}
return {
separator: separator,
transform: transform,
}
}
/**
* Converts a string into a slug
*/
UrlSlug.prototype.convert = function (string, separator, transform) {
if ('string' !== typeof string) {
throw new Error('Invalid value, must be a string: "' + string + '".');
}
options = this.prepare(separator, transform);
/* Transliterate and replace invalid characters, then replace non alphanumeric characters with spaces */
string = unidecode(string).replace('[?]', '').replace(CONVERT_REGEXP, '$1 $2').trim();
/* Pass string through transform function */
if (options.transform) {
string = options.transform(string);
}
/* Replace spaces with separator and return */
return string.replace(CONVERT_SEPARATOR_REGEXP, options.separator);
};
/**
* Reverts a slug back to a string
*/
UrlSlug.prototype.revert = function (slug, separator, transform) {
if ('string' !== typeof slug) {
throw new Error('Invalid value, must be a string: "' + slug + '".');
}
options = this.prepare(separator, transform);
/* Determine which regular expression will be used to—and—remove separators */
if ('' === options.separator) {
slug = slug.replace(REVERT_CAMEL_CASE_REGEXP, '$1 $2');
} else if ('string' === typeof separator) {
/* If separator argument was set as string, don't check options.separator,
it can return the default separator (this.separator) */
REVERT_REGEXP[separator] = REVERT_REGEXP[separator] || new RegExp('\\' + separator.split('').join('\\'), 'g');
slug = slug.replace(REVERT_REGEXP[separator], ' ');
} else {
slug = slug.replace(REVERT_AUTO_REGEXP, '$1 $2');
}
/* Pass slug through transform function and return. Check if transform
was set in arguments, to avoid using the default transform. */
return transform && options.transform ? options.transform(slug) : slug;
};
/* Prepare the global instance and export it */
var urlSlug = new UrlSlug;
var globalInstance = urlSlug.convert.bind(urlSlug);
globalInstance.UrlSlug = UrlSlug;
globalInstance.convert = globalInstance;
globalInstance.revert = urlSlug.revert.bind(urlSlug);
module.exports = globalInstance;

27
assets_old/node_modules/url-slug/package.json generated vendored Normal file
View file

@ -0,0 +1,27 @@
{
"name": "url-slug",
"version": "2.0.0",
"description": "RFC 3986 compliant slug generator with support for multiple languages",
"main": "index.js",
"dependencies": {
"unidecode": "0.1.8"
},
"devDependencies": {
"chai": "3.5.0",
"mocha": "2.5.3"
},
"scripts": {
"test": "mocha test"
},
"repository": "sbtoledo/url-slug",
"keywords": [
"slug",
"slugs",
"slugify",
"url",
"string",
"seo"
],
"author": "Saulo Toledo (sbtoledo.github.io)",
"license": "MIT"
}

156
assets_old/node_modules/url-slug/test/index.js generated vendored Normal file
View file

@ -0,0 +1,156 @@
var expect = require('chai').expect;
var urlSlug = require('../index');
describe('module', function () {
it('should include constructor as a property', function () {
expect(urlSlug.UrlSlug.constructor).to.be.equal(urlSlug.constructor);
});
it('should contain convert and revert methods', function () {
expect(urlSlug.convert).to.be.a('function');
expect(urlSlug.revert).to.be.a('function');
});
it('should call convert if called as a function', function () {
expect(urlSlug).to.be.equal(urlSlug.convert);
});
describe('instance', function () {
var instance = new urlSlug.UrlSlug;
it('should contain lowercase, uppercase and titlecase builtin transformers', function () {
expect(instance.transformers).to.contain.all.keys('lowercase', 'uppercase', 'titlecase');
});
it('should set "-" as default separator', function () {
expect(instance.separator).to.be.equal('-');
});
it('should set "lowercase" as default transformer', function () {
expect(instance.transform).to.be.equal(instance.transformers.lowercase);
});
describe('transformers', function () {
it('should contain a working lowercase', function () {
expect(instance.transformers.lowercase('TEST STRING')).to.be.equal('test string');
});
it('should contain a working uppercase', function () {
expect(instance.transformers.uppercase('test string')).to.be.equal('TEST STRING');
});
it('should contain a working titlecase', function () {
expect(instance.transformers.titlecase('tesT strinG')).to.be.equal('Test String');
});
});
describe('prepare', function () {
it('should not accept nothing but a string as a separator', function () {
expect(instance.prepare.bind(instance, 123)).to.throw(/^Invalid separator, must be a string/);
});
it('should accept all characters defined as unreserved in RFC 3986 as a separator', function () {
expect(instance.prepare.bind(instance, '-._~')).to.not.throw(/^Invalid separator, has invalid characters/);
});
it('should not accept a separator character not defined as unreserved in RFC 3986', function () {
expect(instance.prepare.bind(instance, '+')).to.throw(/^Invalid separator, has invalid characters/);
});
it('should accept false as transform', function () {
expect(instance.prepare.bind(instance, '', false)).not.to.throw(/^Invalid transform, must be a function/);
});
it('should accept all builtin presets as transform', function () {
expect(instance.prepare.bind(instance, '', 'lowercase')).to.not.throw(/^Invalid transform, must be a function/);
expect(instance.prepare.bind(instance, '', 'uppercase')).to.not.throw(/^Invalid transform, must be a function/);
expect(instance.prepare.bind(instance, '', 'titlecase')).to.not.throw(/^Invalid transform, must be a function/);
});
it('should accept a function as transform', function () {
expect(instance.prepare.bind(instance, '', function () {})).to.not.throw(/^Invalid transform, must be a function/);
});
it('should only accept false, a function or a builtin preset as transform', function () {
expect(instance.prepare.bind(instance, '', true)).to.throw(/^Invalid transform, must be a builtin transform or a function/);
expect(instance.prepare.bind(instance, '', 'nonexistent')).to.throw(/^Invalid transform, must be a builtin transform or a function/);
expect(instance.prepare.bind(instance, '', {})).to.throw(/^Invalid transform, must be a builtin transform or a function/);
});
it('should return an object with all available options', function () {
expect(instance.prepare()).to.contain.all.keys('separator', 'transform');
});
});
describe('convert', function () {
it('should not accept nothing but a string as input', function () {
expect(instance.convert.bind(instance, 123)).to.throw(/^Invalid value, must be a string/);
});
it('should return a default slug if no options are set', function () {
expect(instance.convert('Url Slug')).to.be.equal('url-slug');
});
it('should remove accents', function () {
expect(instance.convert('á é í ó ú')).to.be.equal('a-e-i-o-u');
});
it('should convert to upper case and use default separator', function () {
expect(instance.convert('a bronx tale', null, 'uppercase')).to.be.equal('A-BRONX-TALE');
});
it('should use underscore separators and title case', function () {
expect(instance.convert('tom jobim', '_', 'titlecase')).to.be.equal('Tom_Jobim');
});
it('should allow multiple characters in separator and not change the case', function () {
expect(instance.convert('Charly García', '-._~-._~', false)).to.be.equal('Charly-._~-._~Garcia');
});
it('should return a camel case string', function () {
expect(instance.convert('java script', '', 'titlecase')).to.be.equal('JavaScript');
});
it('should break a camel case string', function () {
expect(instance.convert('javaScript')).to.be.equal('java-script');
});
it('should return only consonants', function () {
var transform = function (string) {
return string.replace(/[aeiou]/gi, '');
}
expect(instance.convert('React', '', transform)).to.be.equal('Rct');
});
});
describe('revert', function () {
it('should not accept nothing but a string as input', function () {
expect(instance.revert.bind(instance, 123)).to.throw(/^Invalid value, must be a string/);
});
it('should use automatic reversion and maintain input case', function () {
expect(instance.revert('UrlSlug-url_slug')).to.be.equal('Url Slug url slug');
});
it('should break only on camel case and convert input to upper case', function () {
expect(instance.revert('ClaudioBaglioni_is-Italian', '', 'uppercase')).to.be.equal('CLAUDIO BAGLIONI_IS-ITALIAN');
});
it('should return the title of a Pink Floyd track', function () {
expect(instance.revert('comfortably-._~numb', '-._~', 'titlecase')).to.be.equal('Comfortably Numb');
});
});
});
});