lumen-lib 0.0.0-stage → 2.1.0
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 +72 -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/lumen-backup.svg +48 -0
- package/assets/logos/lumen.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 +230 -0
- package/assets/site/index.html +112 -0
- package/assets/site/site.css +226 -0
- package/assets/site/site.js +239 -0
- package/index.cjs +324 -0
- package/index.d.ts +76 -0
- package/package.json +36 -4
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lumen-lib
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Small, dependency-free utilities for modern web apps — classnames, strings, formatting, math, objects, and async helpers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install lumen-lib
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const { cn, formatBytes, debounce, timeAgo } = require("lumen-lib");
|
|
15
|
+
|
|
16
|
+
cn("btn", isActive && "btn--active", className);
|
|
17
|
+
// => "btn btn--active my-class"
|
|
18
|
+
|
|
19
|
+
formatBytes(1536); // => "1.5 KB"
|
|
20
|
+
formatCompact(3400000); // => "3.4M"
|
|
21
|
+
timeAgo(Date.now() - 3e6); // => "50 minutes ago"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
ESM `import` syntax also works — the package ships CommonJS with named exports and full TypeScript declarations.
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
**classnames**
|
|
29
|
+
- `cn(...classes)` — join class names, ignoring falsy values
|
|
30
|
+
|
|
31
|
+
**strings**
|
|
32
|
+
- `capitalize(s)` — uppercase the first character
|
|
33
|
+
- `kebabCase(s)` / `camelCase(s)` — case conversion
|
|
34
|
+
- `truncate(s, max, ellipsis)` — cut a string with an ellipsis
|
|
35
|
+
- `stripHtml(s)` — remove all HTML tags
|
|
36
|
+
|
|
37
|
+
**formatting**
|
|
38
|
+
- `formatBytes(bytes, decimals)` — `1.5 MB`
|
|
39
|
+
- `formatNumber(n, locale)` — locale-aware grouping
|
|
40
|
+
- `formatCompact(n)` — `1.2K`, `3.4M`
|
|
41
|
+
- `timeAgo(date, now)` — `3 hours ago`
|
|
42
|
+
|
|
43
|
+
**math**
|
|
44
|
+
- `clamp(n, min, max)` — constrain to a range
|
|
45
|
+
- `lerp(a, b, t)` — linear interpolation
|
|
46
|
+
- `randomInt(min, max)` — random integer, inclusive
|
|
47
|
+
- `mapRange(n, inMin, inMax, outMin, outMax)` — remap between ranges
|
|
48
|
+
|
|
49
|
+
**objects & arrays**
|
|
50
|
+
- `deepMerge(target, ...sources)` — recursive object merge
|
|
51
|
+
- `omit(obj, keys)` / `pick(obj, keys)` — key filtering
|
|
52
|
+
- `chunk(arr, size)` — split into fixed-size chunks
|
|
53
|
+
- `unique(arr)` — deduplicate
|
|
54
|
+
- `groupBy(arr, fn)` — group by computed key
|
|
55
|
+
|
|
56
|
+
**functions**
|
|
57
|
+
- `debounce(fn, ms)` — invoke after quiet period (cancelable)
|
|
58
|
+
- `throttle(fn, ms)` — invoke at most once per interval
|
|
59
|
+
- `once(fn)` — only the first call runs
|
|
60
|
+
- `sleep(ms)` — promise-based delay
|
|
61
|
+
- `retry(fn, tries, delay)` — async retry with backoff
|
|
62
|
+
|
|
63
|
+
**validation**
|
|
64
|
+
- `isEmail(s)` — loose email check
|
|
65
|
+
- `isUrl(s)` — loose URL/domain check
|
|
66
|
+
- `isNonEmptyString(v)` — type guard
|
|
67
|
+
|
|
68
|
+
**ids**
|
|
69
|
+
- `uid(length)` — random id, crypto-backed when available
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
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="lumen-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>Lumen</title>
|
|
24
|
+
<meta name="description" content="Lumen 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="lumen-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(#lumen-g)"/>
|
|
9
|
+
<g stroke="url(#lumen-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
|