@bbki.ng/components 1.5.29 → 1.5.32
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/dist/index.d.ts +3 -2
- package/dist/index.js +30 -29
- package/dist/index.mjs +30 -29
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FunctionComponent, EventHandler, ReactElement, CSSProperties, Ref
|
|
1
|
+
import React, { FunctionComponent, EventHandler, ReactElement, ReactNode, CSSProperties, Ref } from 'react';
|
|
2
2
|
import { LinkProps as LinkProps$1 } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
declare type ArticleProps = {
|
|
@@ -82,7 +82,7 @@ declare const Panel: (props: PanelProps) => JSX.Element;
|
|
|
82
82
|
declare type PageProps = {
|
|
83
83
|
nav: ReactElement;
|
|
84
84
|
main: ReactElement;
|
|
85
|
-
footer:
|
|
85
|
+
footer: ReactNode;
|
|
86
86
|
};
|
|
87
87
|
declare const Page: (props: PageProps) => JSX.Element;
|
|
88
88
|
declare const NotFound: (props: {
|
|
@@ -273,6 +273,7 @@ interface IOpt {
|
|
|
273
273
|
color: number[];
|
|
274
274
|
spiralConstA: number;
|
|
275
275
|
spiralConstB: number;
|
|
276
|
+
offset?: number;
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
interface LoadingSpiralProps extends IOpt, ISettings {
|
package/dist/index.js
CHANGED
|
@@ -1068,6 +1068,7 @@ var createSettings = (settings) => {
|
|
|
1068
1068
|
var VERTEX_SHADER = `
|
|
1069
1069
|
attribute vec3 ${"aPositionStart" /* POSITION_START */};
|
|
1070
1070
|
attribute vec3 ${"aColor" /* COLOR */};
|
|
1071
|
+
attribute float ${"aOffsetY" /* OFFSET_Y */};
|
|
1071
1072
|
uniform mat4 uProjectionMatrix;
|
|
1072
1073
|
uniform mat4 uModelMatrix;
|
|
1073
1074
|
uniform mat4 uViewMatrix;
|
|
@@ -1081,6 +1082,14 @@ var VERTEX_SHADER = `
|
|
|
1081
1082
|
0.0, 0.0, 0.0, 1.0
|
|
1082
1083
|
);
|
|
1083
1084
|
}
|
|
1085
|
+
mat4 translateY(float _offset){
|
|
1086
|
+
return mat4(
|
|
1087
|
+
1.0, 0.0, 0.0, 0.0,
|
|
1088
|
+
0.0, 1.0, 0.0, -1.0 * _offset,
|
|
1089
|
+
0.0, 0.0, 1.0, 0.0,
|
|
1090
|
+
0.0, 0.0, 0.0, 1.0
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1084
1093
|
mat4 translate(float _angle){
|
|
1085
1094
|
return mat4(
|
|
1086
1095
|
1.0, 0.0, 0.0, sin(_angle) * 0.02,
|
|
@@ -1090,7 +1099,7 @@ var VERTEX_SHADER = `
|
|
|
1090
1099
|
);
|
|
1091
1100
|
}
|
|
1092
1101
|
void main(){
|
|
1093
|
-
gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
|
|
1102
|
+
gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress) * translateY(${"aOffsetY" /* OFFSET_Y */});
|
|
1094
1103
|
gl_PointSize = 1.0;
|
|
1095
1104
|
vColor = ${"aColor" /* COLOR */};
|
|
1096
1105
|
}
|
|
@@ -1110,27 +1119,27 @@ var scaleIndex = (multiplier, max) => (index) => {
|
|
|
1110
1119
|
return index / (multiplier / max);
|
|
1111
1120
|
};
|
|
1112
1121
|
var scaleIndex2ang = (multiplier) => scaleIndex(multiplier, 360);
|
|
1113
|
-
var getRandom = (value, index = 1) => {
|
|
1114
|
-
return value + Math.random() * value * 0.04 * index;
|
|
1115
|
-
};
|
|
1116
1122
|
var rgba = (val) => {
|
|
1117
1123
|
const [r, g, b, a] = val;
|
|
1118
1124
|
return [r / 255, g / 255, b / 255, a];
|
|
1119
1125
|
};
|
|
1120
|
-
var randOpacityRgb = (val) => {
|
|
1121
|
-
const [r, g, b] = val;
|
|
1122
|
-
return rgba([r, g, b, Math.random()]);
|
|
1123
|
-
};
|
|
1124
1126
|
|
|
1125
1127
|
// src/loading-spiral/createOptions.ts
|
|
1126
1128
|
var DEFAULT_OPT = {
|
|
1127
|
-
multiplier:
|
|
1129
|
+
multiplier: 1e4,
|
|
1128
1130
|
color: [209, 213, 219, 1],
|
|
1129
1131
|
spiralConstA: 0.04,
|
|
1130
|
-
spiralConstB: 0.16
|
|
1132
|
+
spiralConstB: 0.16,
|
|
1133
|
+
offset: -0.3
|
|
1131
1134
|
};
|
|
1132
1135
|
var createOptions = (opt = DEFAULT_OPT) => {
|
|
1133
|
-
const {
|
|
1136
|
+
const {
|
|
1137
|
+
multiplier,
|
|
1138
|
+
spiralConstA,
|
|
1139
|
+
spiralConstB,
|
|
1140
|
+
color,
|
|
1141
|
+
offset = -1 * 0.3
|
|
1142
|
+
} = opt;
|
|
1134
1143
|
const attributes = [
|
|
1135
1144
|
{
|
|
1136
1145
|
name: "aPositionStart" /* POSITION_START */,
|
|
@@ -1140,14 +1149,19 @@ var createOptions = (opt = DEFAULT_OPT) => {
|
|
|
1140
1149
|
const B = spiralConstB;
|
|
1141
1150
|
const xPos = A * Math.pow(Math.E, B * ang) * Math.cos(ang);
|
|
1142
1151
|
const yPos = A * Math.pow(Math.E, B * ang) * Math.sin(ang);
|
|
1143
|
-
return [
|
|
1152
|
+
return [xPos, yPos, 1];
|
|
1144
1153
|
},
|
|
1145
1154
|
size: 3
|
|
1146
1155
|
},
|
|
1147
1156
|
{
|
|
1148
1157
|
name: "aColor" /* COLOR */,
|
|
1149
|
-
data: () =>
|
|
1158
|
+
data: () => rgba(color),
|
|
1150
1159
|
size: 3
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
name: "aOffsetY" /* OFFSET_Y */,
|
|
1163
|
+
data: () => [offset],
|
|
1164
|
+
size: 1
|
|
1151
1165
|
}
|
|
1152
1166
|
];
|
|
1153
1167
|
return {
|
|
@@ -1160,7 +1174,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
|
|
|
1160
1174
|
|
|
1161
1175
|
// src/loading-spiral/useCanvasRef.ts
|
|
1162
1176
|
var import_react22 = require("react");
|
|
1163
|
-
var useResizedCanvasRef = (maxSize
|
|
1177
|
+
var useResizedCanvasRef = (maxSize) => {
|
|
1164
1178
|
const canvasRef = (0, import_react22.useRef)(null);
|
|
1165
1179
|
const containerRef = (0, import_react22.useRef)(null);
|
|
1166
1180
|
(0, import_react22.useEffect)(() => {
|
|
@@ -1171,7 +1185,6 @@ var useResizedCanvasRef = (maxSize, offset) => {
|
|
|
1171
1185
|
const { width, height } = container.getBoundingClientRect();
|
|
1172
1186
|
const canvasSize = Math.max(width, height);
|
|
1173
1187
|
const size = Math.min(canvasSize, maxSize);
|
|
1174
|
-
canvas.style.top = `${offset}px`;
|
|
1175
1188
|
canvas.setAttribute("width", `${size}`);
|
|
1176
1189
|
canvas.setAttribute("height", `${size}`);
|
|
1177
1190
|
}, []);
|
|
@@ -1183,20 +1196,8 @@ var useResizedCanvasRef = (maxSize, offset) => {
|
|
|
1183
1196
|
|
|
1184
1197
|
// src/loading-spiral/LoadingSpiral.tsx
|
|
1185
1198
|
var LoadingSpiral = (props) => {
|
|
1186
|
-
const _a = props || {}, {
|
|
1187
|
-
|
|
1188
|
-
canvas,
|
|
1189
|
-
step,
|
|
1190
|
-
maxWidth = 1e3,
|
|
1191
|
-
offset = -100
|
|
1192
|
-
} = _a, rest = __objRest(_a, [
|
|
1193
|
-
"className",
|
|
1194
|
-
"canvas",
|
|
1195
|
-
"step",
|
|
1196
|
-
"maxWidth",
|
|
1197
|
-
"offset"
|
|
1198
|
-
]);
|
|
1199
|
-
const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth, offset);
|
|
1199
|
+
const _a = props || {}, { className, canvas, step, maxWidth = 1e3 } = _a, rest = __objRest(_a, ["className", "canvas", "step", "maxWidth"]);
|
|
1200
|
+
const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth);
|
|
1200
1201
|
(0, import_react23.useEffect)(() => {
|
|
1201
1202
|
if (!canvasRef.current) {
|
|
1202
1203
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -1010,6 +1010,7 @@ var createSettings = (settings) => {
|
|
|
1010
1010
|
var VERTEX_SHADER = `
|
|
1011
1011
|
attribute vec3 ${"aPositionStart" /* POSITION_START */};
|
|
1012
1012
|
attribute vec3 ${"aColor" /* COLOR */};
|
|
1013
|
+
attribute float ${"aOffsetY" /* OFFSET_Y */};
|
|
1013
1014
|
uniform mat4 uProjectionMatrix;
|
|
1014
1015
|
uniform mat4 uModelMatrix;
|
|
1015
1016
|
uniform mat4 uViewMatrix;
|
|
@@ -1023,6 +1024,14 @@ var VERTEX_SHADER = `
|
|
|
1023
1024
|
0.0, 0.0, 0.0, 1.0
|
|
1024
1025
|
);
|
|
1025
1026
|
}
|
|
1027
|
+
mat4 translateY(float _offset){
|
|
1028
|
+
return mat4(
|
|
1029
|
+
1.0, 0.0, 0.0, 0.0,
|
|
1030
|
+
0.0, 1.0, 0.0, -1.0 * _offset,
|
|
1031
|
+
0.0, 0.0, 1.0, 0.0,
|
|
1032
|
+
0.0, 0.0, 0.0, 1.0
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1026
1035
|
mat4 translate(float _angle){
|
|
1027
1036
|
return mat4(
|
|
1028
1037
|
1.0, 0.0, 0.0, sin(_angle) * 0.02,
|
|
@@ -1032,7 +1041,7 @@ var VERTEX_SHADER = `
|
|
|
1032
1041
|
);
|
|
1033
1042
|
}
|
|
1034
1043
|
void main(){
|
|
1035
|
-
gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
|
|
1044
|
+
gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress) * translateY(${"aOffsetY" /* OFFSET_Y */});
|
|
1036
1045
|
gl_PointSize = 1.0;
|
|
1037
1046
|
vColor = ${"aColor" /* COLOR */};
|
|
1038
1047
|
}
|
|
@@ -1052,27 +1061,27 @@ var scaleIndex = (multiplier, max) => (index) => {
|
|
|
1052
1061
|
return index / (multiplier / max);
|
|
1053
1062
|
};
|
|
1054
1063
|
var scaleIndex2ang = (multiplier) => scaleIndex(multiplier, 360);
|
|
1055
|
-
var getRandom = (value, index = 1) => {
|
|
1056
|
-
return value + Math.random() * value * 0.04 * index;
|
|
1057
|
-
};
|
|
1058
1064
|
var rgba = (val) => {
|
|
1059
1065
|
const [r, g, b, a] = val;
|
|
1060
1066
|
return [r / 255, g / 255, b / 255, a];
|
|
1061
1067
|
};
|
|
1062
|
-
var randOpacityRgb = (val) => {
|
|
1063
|
-
const [r, g, b] = val;
|
|
1064
|
-
return rgba([r, g, b, Math.random()]);
|
|
1065
|
-
};
|
|
1066
1068
|
|
|
1067
1069
|
// src/loading-spiral/createOptions.ts
|
|
1068
1070
|
var DEFAULT_OPT = {
|
|
1069
|
-
multiplier:
|
|
1071
|
+
multiplier: 1e4,
|
|
1070
1072
|
color: [209, 213, 219, 1],
|
|
1071
1073
|
spiralConstA: 0.04,
|
|
1072
|
-
spiralConstB: 0.16
|
|
1074
|
+
spiralConstB: 0.16,
|
|
1075
|
+
offset: -0.3
|
|
1073
1076
|
};
|
|
1074
1077
|
var createOptions = (opt = DEFAULT_OPT) => {
|
|
1075
|
-
const {
|
|
1078
|
+
const {
|
|
1079
|
+
multiplier,
|
|
1080
|
+
spiralConstA,
|
|
1081
|
+
spiralConstB,
|
|
1082
|
+
color,
|
|
1083
|
+
offset = -1 * 0.3
|
|
1084
|
+
} = opt;
|
|
1076
1085
|
const attributes = [
|
|
1077
1086
|
{
|
|
1078
1087
|
name: "aPositionStart" /* POSITION_START */,
|
|
@@ -1082,14 +1091,19 @@ var createOptions = (opt = DEFAULT_OPT) => {
|
|
|
1082
1091
|
const B = spiralConstB;
|
|
1083
1092
|
const xPos = A * Math.pow(Math.E, B * ang) * Math.cos(ang);
|
|
1084
1093
|
const yPos = A * Math.pow(Math.E, B * ang) * Math.sin(ang);
|
|
1085
|
-
return [
|
|
1094
|
+
return [xPos, yPos, 1];
|
|
1086
1095
|
},
|
|
1087
1096
|
size: 3
|
|
1088
1097
|
},
|
|
1089
1098
|
{
|
|
1090
1099
|
name: "aColor" /* COLOR */,
|
|
1091
|
-
data: () =>
|
|
1100
|
+
data: () => rgba(color),
|
|
1092
1101
|
size: 3
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
name: "aOffsetY" /* OFFSET_Y */,
|
|
1105
|
+
data: () => [offset],
|
|
1106
|
+
size: 1
|
|
1093
1107
|
}
|
|
1094
1108
|
];
|
|
1095
1109
|
return {
|
|
@@ -1102,7 +1116,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
|
|
|
1102
1116
|
|
|
1103
1117
|
// src/loading-spiral/useCanvasRef.ts
|
|
1104
1118
|
import { useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
1105
|
-
var useResizedCanvasRef = (maxSize
|
|
1119
|
+
var useResizedCanvasRef = (maxSize) => {
|
|
1106
1120
|
const canvasRef = useRef2(null);
|
|
1107
1121
|
const containerRef = useRef2(null);
|
|
1108
1122
|
useEffect3(() => {
|
|
@@ -1113,7 +1127,6 @@ var useResizedCanvasRef = (maxSize, offset) => {
|
|
|
1113
1127
|
const { width, height } = container.getBoundingClientRect();
|
|
1114
1128
|
const canvasSize = Math.max(width, height);
|
|
1115
1129
|
const size = Math.min(canvasSize, maxSize);
|
|
1116
|
-
canvas.style.top = `${offset}px`;
|
|
1117
1130
|
canvas.setAttribute("width", `${size}`);
|
|
1118
1131
|
canvas.setAttribute("height", `${size}`);
|
|
1119
1132
|
}, []);
|
|
@@ -1125,20 +1138,8 @@ var useResizedCanvasRef = (maxSize, offset) => {
|
|
|
1125
1138
|
|
|
1126
1139
|
// src/loading-spiral/LoadingSpiral.tsx
|
|
1127
1140
|
var LoadingSpiral = (props) => {
|
|
1128
|
-
const _a = props || {}, {
|
|
1129
|
-
|
|
1130
|
-
canvas,
|
|
1131
|
-
step,
|
|
1132
|
-
maxWidth = 1e3,
|
|
1133
|
-
offset = -100
|
|
1134
|
-
} = _a, rest = __objRest(_a, [
|
|
1135
|
-
"className",
|
|
1136
|
-
"canvas",
|
|
1137
|
-
"step",
|
|
1138
|
-
"maxWidth",
|
|
1139
|
-
"offset"
|
|
1140
|
-
]);
|
|
1141
|
-
const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth, offset);
|
|
1141
|
+
const _a = props || {}, { className, canvas, step, maxWidth = 1e3 } = _a, rest = __objRest(_a, ["className", "canvas", "step", "maxWidth"]);
|
|
1142
|
+
const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth);
|
|
1142
1143
|
useEffect4(() => {
|
|
1143
1144
|
if (!canvasRef.current) {
|
|
1144
1145
|
return;
|