@jsb188/gfx 1.1.12 → 1.1.13
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/LICENSE +21 -0
- package/package.json +16 -3
- package/utils/dotGridSpecs.ts +15 -4
- package/tsconfig.json +0 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jsb188
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsb188/gfx",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Shared OGL/WebGL2 runtime, fullscreen pass chain, shader passes, and hero/section components for web graphics.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"author": "jsb188",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -48,5 +48,18 @@
|
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc"
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"elements/**/*.{ts,tsx,css,svg}",
|
|
54
|
+
"libs/**/*.{ts,tsx,css,svg}",
|
|
55
|
+
"main.ts",
|
|
56
|
+
"modules/**/*.{ts,tsx,css,svg}",
|
|
57
|
+
"scenes/**/*.{ts,tsx,css,svg}",
|
|
58
|
+
"utils/**/*.{ts,tsx,css,svg}",
|
|
59
|
+
"!**/*.test.*",
|
|
60
|
+
"!**/*.spec.*",
|
|
61
|
+
"!**/tests/**",
|
|
62
|
+
"!**/*.md",
|
|
63
|
+
"!**/.DS_Store"
|
|
64
|
+
]
|
|
52
65
|
}
|
package/utils/dotGridSpecs.ts
CHANGED
|
@@ -42,6 +42,17 @@ export interface DotStyle {
|
|
|
42
42
|
alignY?: DotAlignY | number | DotAlignYOffset;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/* Resting grid shared by the homepage and static directory boards. */
|
|
46
|
+
export const HOME_DOTS = {
|
|
47
|
+
shape: 'rounded_square',
|
|
48
|
+
size: 2,
|
|
49
|
+
spacing: 16,
|
|
50
|
+
color: '#E0E0E0',
|
|
51
|
+
opacity: 1,
|
|
52
|
+
alignX: 'center',
|
|
53
|
+
alignY: 1,
|
|
54
|
+
} satisfies Required<DotStyle>;
|
|
55
|
+
|
|
45
56
|
/** How a moving cursor throws the dots, and how they come back. */
|
|
46
57
|
export interface DotKick {
|
|
47
58
|
/** Radius in CSS pixels around the moving cursor within which dots are kicked. */
|
|
@@ -385,19 +396,19 @@ export function getDotGridMaskPosition({ size, spacing, alignX, alignY }: Requir
|
|
|
385
396
|
* it at `spacing × spacing` positioned by `getDotGridMaskPosition` and it lines up exactly
|
|
386
397
|
* with the WebGL grid.
|
|
387
398
|
*/
|
|
388
|
-
export function makeDotGridTileUrl({ size, shape, spacing }: Pick<Required<DotStyle>, 'size' | 'shape' | 'spacing'
|
|
399
|
+
export function makeDotGridTileUrl({ size, shape, spacing }: Pick<Required<DotStyle>, 'size' | 'shape' | 'spacing'>, color = 'black') {
|
|
389
400
|
const half = spacing / 2;
|
|
390
401
|
const r = size / 2;
|
|
391
402
|
const stroke = r * (1 - DOT_RING_INNER_RADIUS);
|
|
392
403
|
let dot: string;
|
|
393
404
|
if (shape === 'rounded_square' || shape === 'ring_rectangle') {
|
|
394
405
|
const inset = shape === 'ring_rectangle' ? stroke / 2 : 0;
|
|
395
|
-
const outline = shape === 'ring_rectangle' ? ` fill="none" stroke="
|
|
406
|
+
const outline = shape === 'ring_rectangle' ? ` fill="none" stroke="${color}" stroke-width="${stroke}"` : ` fill="${color}"`;
|
|
396
407
|
dot = `<rect x="${half - r + inset}" y="${half - r + inset}" width="${size - inset * 2}" height="${size - inset * 2}" rx="${r * DOT_ROUNDED_SQUARE_CORNER - inset}"${outline}/>`;
|
|
397
408
|
} else if (shape === 'ring') {
|
|
398
|
-
dot = `<circle cx="${half}" cy="${half}" r="${r - stroke / 2}" fill="none" stroke="
|
|
409
|
+
dot = `<circle cx="${half}" cy="${half}" r="${r - stroke / 2}" fill="none" stroke="${color}" stroke-width="${stroke}"/>`;
|
|
399
410
|
} else {
|
|
400
|
-
dot = `<circle cx="${half}" cy="${half}" r="${r}"/>`;
|
|
411
|
+
dot = `<circle cx="${half}" cy="${half}" r="${r}" fill="${color}"/>`;
|
|
401
412
|
}
|
|
402
413
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${spacing} ${spacing}">${dot}</svg>`;
|
|
403
414
|
return `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"allowImportingTsExtensions": true,
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true
|
|
11
|
-
},
|
|
12
|
-
"include": ["main.ts", "libs/**/*", "utils/**/*", "scenes/**/*", "modules/**/*", "elements/**/*"]
|
|
13
|
-
}
|