@sharadox/web-library 0.10.0-polish.24 → 0.11.0-dependency-update.36
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/CHANGELOG.md +4 -0
- package/README.md +1 -0
- package/distribution/graphics/web-gl-support/index.d.ts +11 -0
- package/distribution/graphics/web-gl-support/index.d.ts.map +1 -0
- package/distribution/graphics/web-gl-support/index.js +19 -0
- package/distribution/graphics/web-gl-support/index.js.map +1 -0
- package/llms.txt +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of `@sharadox/web-library`, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.11.0
|
|
6
|
+
|
|
7
|
+
`graphics/web-gl-support`: `supportsWebGl()` (moved from globe-web-library), so every WebGL scene can fall back to a still picture instead of failing to start.
|
|
8
|
+
|
|
5
9
|
## 0.10.0
|
|
6
10
|
|
|
7
11
|
`identifier/uuid-version-7`: `uuidVersion7()`, a new UUID version 7 (time first, so identifiers sort by when they were made).
|
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Import each utility by its path:
|
|
|
41
41
|
| `…/text/separate` | `separate(separator, ...parts)` | `separate(SEPARATOR, "Contact", "Ana") // "Contact · Ana"` |
|
|
42
42
|
| `…/text/separated` | `separated(...parts)`: `separate` with the shared `SEPARATOR` | `separated("Contact", "Ana") // "Contact · Ana"` |
|
|
43
43
|
| `…/identifier/uuid-version-7` | `uuidVersion7()`: a new UUID version 7, time first so identifiers sort by when they were made | `uuidVersion7() // "019a8f3c-6b2e-7c41-…"` |
|
|
44
|
+
| `…/graphics/web-gl-support` | `supportsWebGl()`: whether the browser can create a WebGL context, to show a still fallback instead of a scene that would fail | `supportsWebGl() // true` |
|
|
44
45
|
| `…/text/two-digit` | `twoDigits(count)`: a count as two digits | `twoDigits(3) // "03"` |
|
|
45
46
|
| `…/request/client-address` | `clientAddress(headers)`: the visitor's address from `x-forwarded-for`, or `"unknown"` | `clientAddress(await headers())` |
|
|
46
47
|
| `…/math/clamp` | `clamp(value, minimum, maximum)` | `clamp(5, 0, 1) // 1` |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this browser can create a WebGL context (2 or 1). False when it can't or refuses (old devices, WebGL turned
|
|
3
|
+
* off or blocked) and outside a browser: show a still fallback instead of a WebGL scene, which would otherwise fail
|
|
4
|
+
* to start.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const [webGl] = useState(supportsWebGl); // in a client component
|
|
8
|
+
* return webGl ? <Scene /> : <Fallback />;
|
|
9
|
+
*/
|
|
10
|
+
export declare function supportsWebGl(): boolean;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/graphics/web-gl-support/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAOvC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this browser can create a WebGL context (2 or 1). False when it can't or refuses (old devices, WebGL turned
|
|
3
|
+
* off or blocked) and outside a browser: show a still fallback instead of a WebGL scene, which would otherwise fail
|
|
4
|
+
* to start.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const [webGl] = useState(supportsWebGl); // in a client component
|
|
8
|
+
* return webGl ? <Scene /> : <Fallback />;
|
|
9
|
+
*/
|
|
10
|
+
export function supportsWebGl() {
|
|
11
|
+
try {
|
|
12
|
+
const canvas = globalThis.document.createElement("canvas");
|
|
13
|
+
return !!(canvas.getContext("webgl2") || canvas.getContext("webgl"));
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/graphics/web-gl-support/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC;QACH,MAAM,MAAM,GAAI,UAAyB,CAAC,QAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC5E,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
- html/escape → escapeHtml(text)
|
|
13
13
|
- text/separator → SEPARATOR "·", the one separator every Sharadox site and library uses
|
|
14
14
|
- text/separate → separate(separator, ...parts): "a · b", skipping empty parts (pass SEPARATOR)
|
|
15
|
+
- graphics/web-gl-support → supportsWebGl(): WebGL 2 or 1 available (false when refused or outside a browser); render a fallback instead of a WebGL scene
|
|
15
16
|
- identifier/uuid-version-7 → uuidVersion7({ now?, random? }?): RFC 9562 UUID version 7 (48-bit millisecond time, then random; sorts by creation), e.g. a contact conversation identifier
|
|
16
17
|
- text/separated → separated(...parts): separate with SEPARATOR, the one every Sharadox text uses
|
|
17
18
|
- text/two-digit → twoDigits(count): 1 → "01" (numbered lists and steps)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/web-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-dependency-update.36",
|
|
4
4
|
"description": "General TypeScript utilities shared by every Sharadox library and application: type guards, class names, HTML escaping, text joining, identifiers, math helpers and exhaustiveness checks.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"@sharadox/turborepo-configuration-web-library": "^0.1.3",
|
|
46
46
|
"@sharadox/type-script-configuration-web-library": "^0.2.2",
|
|
47
47
|
"@sharadox/vitest-configuration-web-library": "^0.2.0",
|
|
48
|
-
"@types/node": "^
|
|
49
|
-
"@vitest/coverage-v8": "^5.1.
|
|
48
|
+
"@types/node": "^26.6.6",
|
|
49
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
50
50
|
"eslint": "9.39.5",
|
|
51
51
|
"husky": "^9.1.7",
|
|
52
|
-
"lint-staged": "^17.6.
|
|
53
|
-
"prettier": "^3.10.
|
|
54
|
-
"turbo": "^2.11.
|
|
52
|
+
"lint-staged": "^17.6.2",
|
|
53
|
+
"prettier": "^3.10.1",
|
|
54
|
+
"turbo": "^2.11.13",
|
|
55
55
|
"typedoc": "^0.28.20",
|
|
56
56
|
"typescript": "6.0.3",
|
|
57
|
-
"vitest": "^5.1.
|
|
57
|
+
"vitest": "^5.1.1"
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
|
60
60
|
"type": "git",
|