slug-lib-js 0.0.0-stage → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/assets/bg/blue.mp4 +0 -0
- package/assets/bg/green.mp4 +0 -0
- package/assets/bg/poster.jpg +0 -0
- package/assets/bg/teal.mp4 +0 -0
- package/assets/fonts/auge-bold.otf +0 -0
- package/assets/fonts/auge-regular.otf +0 -0
- package/assets/fonts/auge-semibold.otf +0 -0
- package/assets/fonts/inter-var.ttf +0 -0
- package/assets/fonts/jetbrains-mono-var.ttf +0 -0
- package/assets/fonts/pacifico.ttf +0 -0
- package/assets/fonts/space-grotesk-var.ttf +0 -0
- package/assets/logos/slug-lib-js-backup.svg +48 -0
- package/assets/logos/slug-lib-js.svg +19 -0
- package/assets/site/backup/Pacifico-Regular-95szj24p.ttf +0 -0
- package/assets/site/backup/auge-bold-vywa1g7b.otf +0 -0
- package/assets/site/backup/auge-regular-hz0spgka.otf +0 -0
- package/assets/site/backup/auge-semibold-td2xkdwf.otf +0 -0
- package/assets/site/backup/copium-meme.png +0 -0
- package/assets/site/backup/engine/controller.api.js +1344 -0
- package/assets/site/backup/engine/controller.inject.js +511 -0
- package/assets/site/backup/engine/controller.sw.js +418 -0
- package/assets/site/backup/engine/corridor.js +13215 -0
- package/assets/site/backup/engine/corridor.wasm +0 -0
- package/assets/site/backup/site-backup.css +1 -0
- package/assets/site/backup/site-backup.js +74 -0
- package/assets/site/backup/sw.js +224 -0
- package/assets/site/index.html +112 -0
- package/assets/site/site.css +226 -0
- package/assets/site/site.js +196 -0
- package/index.cjs +69 -0
- package/index.d.ts +22 -0
- package/package.json +29 -4
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# slug-js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Small, dependency-free slug and URL-safe string utilities.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
const { slugify, deslugify, isSlug, uniqueSlug } = require("slug-js");
|
|
7
|
+
|
|
8
|
+
slugify("Hello World!"); // "hello-world"
|
|
9
|
+
slugify("Café Über Alles"); // "cafe-uber-alles"
|
|
10
|
+
deslugify("hello-world"); // "hello world"
|
|
11
|
+
isSlug("my-post-2"); // true
|
|
12
|
+
uniqueSlug("My Post", ["my-post"]); // "my-post-2"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## API
|
|
16
|
+
|
|
17
|
+
- `slugify(str, opts?)` — normalize, transliterate, separator-join. opts: `separator`, `lower`, `strict`, `trim`
|
|
18
|
+
- `deslugify(slug, opts?)` — split back into words. opts: `separator`, `capitalize`
|
|
19
|
+
- `isSlug(str, opts?)` — validate slug shape. opts: `separator`, `allowUpper`
|
|
20
|
+
- `uniqueSlug(base, taken?)` — first free `-2`, `-3`, ... variant
|
|
21
|
+
- `slugWords(slug, opts?)` — slug as word array
|
|
22
|
+
- `slugLength(slug)` — character count
|
|
23
|
+
- `truncateSlug(slug, max, opts?)` — cut on a separator boundary
|
|
24
|
+
- `randomSlug(len?, alphabet?)` — crypto-random slug
|
|
25
|
+
|
|
26
|
+
Zero dependencies, works in Node and browsers.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" style="position:fixed;inset:0;background:#000">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="lb-g" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#fbbf24"/>
|
|
5
|
+
<stop offset="1" stop-color="#f97316"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="slug-lib-js-mark" display="none">
|
|
9
|
+
<circle cx="50" cy="50" r="20" fill="url(#lb-g)"/>
|
|
10
|
+
<g stroke="url(#lb-g)" stroke-width="6" stroke-linecap="round">
|
|
11
|
+
<line x1="50" y1="8" x2="50" y2="22"/><line x1="50" y1="78" x2="50" y2="92"/>
|
|
12
|
+
<line x1="8" y1="50" x2="22" y2="50"/><line x1="78" y1="50" x2="92" y2="50"/>
|
|
13
|
+
<line x1="20.4" y1="20.4" x2="30.1" y2="30.1"/><line x1="69.9" y1="69.9" x2="79.6" y2="79.6"/>
|
|
14
|
+
<line x1="79.6" y1="20.4" x2="69.9" y2="30.1"/><line x1="30.1" y1="69.9" x2="20.4" y2="79.6"/>
|
|
15
|
+
</g>
|
|
16
|
+
</g>
|
|
17
|
+
<foreignObject x="0" y="0" width="100%" height="100%">
|
|
18
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
|
19
|
+
<head>
|
|
20
|
+
<base href="../site/backup/" />
|
|
21
|
+
<meta charset="UTF-8" />
|
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
23
|
+
<title>slug-lib-js</title>
|
|
24
|
+
<meta name="description" content="slug-lib-js asset bundle — backup revision." />
|
|
25
|
+
<link rel="stylesheet" href="site-backup.css" />
|
|
26
|
+
<link rel="icon" href="copium-meme.png" />
|
|
27
|
+
<style>html,body,#root{margin:0;width:100%;height:100%;overflow:hidden}</style>
|
|
28
|
+
<script><![CDATA[
|
|
29
|
+
(function () {
|
|
30
|
+
const XHTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
31
|
+
const root = document.querySelector('foreignObject').firstElementChild;
|
|
32
|
+
const createElementNS = document.createElementNS.bind(document);
|
|
33
|
+
Object.defineProperty(document, 'head', { get: () => root.querySelector('head'), configurable: true });
|
|
34
|
+
Object.defineProperty(document, 'body', { get: () => root.querySelector('body'), configurable: true });
|
|
35
|
+
Object.defineProperty(document, 'documentElement', { get: () => root, configurable: true });
|
|
36
|
+
document.createElement = function (tagName, options) {
|
|
37
|
+
return createElementNS(XHTML_NS, tagName, options);
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
]]></script>
|
|
41
|
+
</head>
|
|
42
|
+
<body>
|
|
43
|
+
<div id="root"></div>
|
|
44
|
+
<script src="site-backup.js"></script>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
47
|
+
</foreignObject>
|
|
48
|
+
</svg>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="slug-lib-js-g" x1="0" y1="0" x2="64" y2="64" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop offset="0" stop-color="#fbbf24"/>
|
|
5
|
+
<stop offset="1" stop-color="#f97316"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<circle cx="32" cy="32" r="13" fill="url(#slug-lib-js-g)"/>
|
|
9
|
+
<g stroke="url(#slug-lib-js-g)" stroke-width="4" stroke-linecap="round">
|
|
10
|
+
<line x1="32" y1="6" x2="32" y2="14"/>
|
|
11
|
+
<line x1="32" y1="50" x2="32" y2="58"/>
|
|
12
|
+
<line x1="6" y1="32" x2="14" y2="32"/>
|
|
13
|
+
<line x1="50" y1="32" x2="58" y2="32"/>
|
|
14
|
+
<line x1="13.6" y1="13.6" x2="19.4" y2="19.4"/>
|
|
15
|
+
<line x1="44.6" y1="44.6" x2="50.4" y2="50.4"/>
|
|
16
|
+
<line x1="50.4" y1="13.6" x2="44.6" y2="19.4"/>
|
|
17
|
+
<line x1="19.4" y1="44.6" x2="13.6" y2="50.4"/>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|