@bbki.ng/components 1.5.26 → 1.5.29

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 CHANGED
@@ -264,7 +264,7 @@ interface GalleryProps extends Omit<RandomRowsLayoutProps, "classNames" | "cells
264
264
  declare const Gallery: (props: GalleryProps) => JSX.Element;
265
265
 
266
266
  interface ISettings {
267
- canvas: HTMLCanvasElement;
267
+ canvas?: HTMLCanvasElement;
268
268
  step?: number;
269
269
  }
270
270
 
@@ -276,8 +276,10 @@ interface IOpt {
276
276
  }
277
277
 
278
278
  interface LoadingSpiralProps extends IOpt, ISettings {
279
- className?: "string";
279
+ className?: string;
280
+ maxWidth?: number;
281
+ offset?: number;
280
282
  }
281
- declare const LoadingSpiral: (props: LoadingSpiralProps) => JSX.Element;
283
+ declare const LoadingSpiral: (props?: LoadingSpiralProps | undefined) => JSX.Element;
282
284
 
283
285
  export { Article, ArticleProps, ArticleSkeleton, ArticleSkeletonProps, BLinkDotProps, BlinkDot, Breadcrumb, BreadcrumbProps, Button, ButtonProps, ButtonType, DropImage, Error, ErrorBoundary, Gallery, GalleryProps, ImageDropProps, ImagePreviewerProps, ImageRenderer, Img, Link, LinkColor, LinkList, LinkListProps, LinkListSkeleton, LinkListSkeletonProps, LinkProps, List, LoadingSpiral, LoadingSpiralProps, Logo, LogoProps, Nav, NavProps, NoiseCover, NoiseCoverProps, NotFound, Page, Panel, PanelProps, PathObj, PopConfirm, PopConfirmProps, Skeleton, SkeletonColor, SkeletonProps, Table, TableProps, Tag, TagProps, Tags, ThreeColLayout, TitledList, TitledListProps, listProps, threeColLayoutProps };
package/dist/index.js CHANGED
@@ -1081,9 +1081,17 @@ var VERTEX_SHADER = `
1081
1081
  0.0, 0.0, 0.0, 1.0
1082
1082
  );
1083
1083
  }
1084
+ mat4 translate(float _angle){
1085
+ return mat4(
1086
+ 1.0, 0.0, 0.0, sin(_angle) * 0.02,
1087
+ 0.0, 1.0, 0.0, cos(_angle) * 0.02,
1088
+ 0.0, 0.0, 1.0, 0.0,
1089
+ 0.0, 0.0, 0.0, 1.0
1090
+ );
1091
+ }
1084
1092
  void main(){
1085
- gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0);
1086
- gl_PointSize = 2.0;
1093
+ gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
1094
+ gl_PointSize = 1.0;
1087
1095
  vColor = ${"aColor" /* COLOR */};
1088
1096
  }
1089
1097
  `;
@@ -1102,6 +1110,9 @@ var scaleIndex = (multiplier, max) => (index) => {
1102
1110
  return index / (multiplier / max);
1103
1111
  };
1104
1112
  var scaleIndex2ang = (multiplier) => scaleIndex(multiplier, 360);
1113
+ var getRandom = (value, index = 1) => {
1114
+ return value + Math.random() * value * 0.04 * index;
1115
+ };
1105
1116
  var rgba = (val) => {
1106
1117
  const [r, g, b, a] = val;
1107
1118
  return [r / 255, g / 255, b / 255, a];
@@ -1113,7 +1124,7 @@ var randOpacityRgb = (val) => {
1113
1124
 
1114
1125
  // src/loading-spiral/createOptions.ts
1115
1126
  var DEFAULT_OPT = {
1116
- multiplier: 3e4,
1127
+ multiplier: 15e4,
1117
1128
  color: [209, 213, 219, 1],
1118
1129
  spiralConstA: 0.04,
1119
1130
  spiralConstB: 0.16
@@ -1129,7 +1140,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1129
1140
  const B = spiralConstB;
1130
1141
  const xPos = A * Math.pow(Math.E, B * ang) * Math.cos(ang);
1131
1142
  const yPos = A * Math.pow(Math.E, B * ang) * Math.sin(ang);
1132
- return [xPos, yPos, 1];
1143
+ return [getRandom(xPos), getRandom(yPos), 1];
1133
1144
  },
1134
1145
  size: 3
1135
1146
  },
@@ -1149,7 +1160,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1149
1160
 
1150
1161
  // src/loading-spiral/useCanvasRef.ts
1151
1162
  var import_react22 = require("react");
1152
- var useResizedCanvasRef = () => {
1163
+ var useResizedCanvasRef = (maxSize, offset) => {
1153
1164
  const canvasRef = (0, import_react22.useRef)(null);
1154
1165
  const containerRef = (0, import_react22.useRef)(null);
1155
1166
  (0, import_react22.useEffect)(() => {
@@ -1159,8 +1170,10 @@ var useResizedCanvasRef = () => {
1159
1170
  return;
1160
1171
  const { width, height } = container.getBoundingClientRect();
1161
1172
  const canvasSize = Math.max(width, height);
1162
- canvas.setAttribute("width", `${canvasSize}`);
1163
- canvas.setAttribute("height", `${canvasSize}`);
1173
+ const size = Math.min(canvasSize, maxSize);
1174
+ canvas.style.top = `${offset}px`;
1175
+ canvas.setAttribute("width", `${size}`);
1176
+ canvas.setAttribute("height", `${size}`);
1164
1177
  }, []);
1165
1178
  return {
1166
1179
  canvasRef,
@@ -1170,8 +1183,20 @@ var useResizedCanvasRef = () => {
1170
1183
 
1171
1184
  // src/loading-spiral/LoadingSpiral.tsx
1172
1185
  var LoadingSpiral = (props) => {
1173
- const { canvasRef, containerRef } = useResizedCanvasRef();
1174
- const _a = props, { className, canvas, step } = _a, rest = __objRest(_a, ["className", "canvas", "step"]);
1186
+ const _a = props || {}, {
1187
+ className,
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);
1175
1200
  (0, import_react23.useEffect)(() => {
1176
1201
  if (!canvasRef.current) {
1177
1202
  return;
@@ -1185,7 +1210,8 @@ var LoadingSpiral = (props) => {
1185
1210
  className: (0, import_classnames13.default)("fixed h-full w-full overflow-hidden flex justify-center items-center", className),
1186
1211
  ref: containerRef
1187
1212
  }, /* @__PURE__ */ import_react23.default.createElement("canvas", {
1188
- ref: canvasRef
1213
+ ref: canvasRef,
1214
+ className: "relative"
1189
1215
  }));
1190
1216
  };
1191
1217
  module.exports = __toCommonJS(src_exports);
package/dist/index.mjs CHANGED
@@ -1023,9 +1023,17 @@ var VERTEX_SHADER = `
1023
1023
  0.0, 0.0, 0.0, 1.0
1024
1024
  );
1025
1025
  }
1026
+ mat4 translate(float _angle){
1027
+ return mat4(
1028
+ 1.0, 0.0, 0.0, sin(_angle) * 0.02,
1029
+ 0.0, 1.0, 0.0, cos(_angle) * 0.02,
1030
+ 0.0, 0.0, 1.0, 0.0,
1031
+ 0.0, 0.0, 0.0, 1.0
1032
+ );
1033
+ }
1026
1034
  void main(){
1027
- gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0);
1028
- gl_PointSize = 2.0;
1035
+ gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
1036
+ gl_PointSize = 1.0;
1029
1037
  vColor = ${"aColor" /* COLOR */};
1030
1038
  }
1031
1039
  `;
@@ -1044,6 +1052,9 @@ var scaleIndex = (multiplier, max) => (index) => {
1044
1052
  return index / (multiplier / max);
1045
1053
  };
1046
1054
  var scaleIndex2ang = (multiplier) => scaleIndex(multiplier, 360);
1055
+ var getRandom = (value, index = 1) => {
1056
+ return value + Math.random() * value * 0.04 * index;
1057
+ };
1047
1058
  var rgba = (val) => {
1048
1059
  const [r, g, b, a] = val;
1049
1060
  return [r / 255, g / 255, b / 255, a];
@@ -1055,7 +1066,7 @@ var randOpacityRgb = (val) => {
1055
1066
 
1056
1067
  // src/loading-spiral/createOptions.ts
1057
1068
  var DEFAULT_OPT = {
1058
- multiplier: 3e4,
1069
+ multiplier: 15e4,
1059
1070
  color: [209, 213, 219, 1],
1060
1071
  spiralConstA: 0.04,
1061
1072
  spiralConstB: 0.16
@@ -1071,7 +1082,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1071
1082
  const B = spiralConstB;
1072
1083
  const xPos = A * Math.pow(Math.E, B * ang) * Math.cos(ang);
1073
1084
  const yPos = A * Math.pow(Math.E, B * ang) * Math.sin(ang);
1074
- return [xPos, yPos, 1];
1085
+ return [getRandom(xPos), getRandom(yPos), 1];
1075
1086
  },
1076
1087
  size: 3
1077
1088
  },
@@ -1091,7 +1102,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1091
1102
 
1092
1103
  // src/loading-spiral/useCanvasRef.ts
1093
1104
  import { useEffect as useEffect3, useRef as useRef2 } from "react";
1094
- var useResizedCanvasRef = () => {
1105
+ var useResizedCanvasRef = (maxSize, offset) => {
1095
1106
  const canvasRef = useRef2(null);
1096
1107
  const containerRef = useRef2(null);
1097
1108
  useEffect3(() => {
@@ -1101,8 +1112,10 @@ var useResizedCanvasRef = () => {
1101
1112
  return;
1102
1113
  const { width, height } = container.getBoundingClientRect();
1103
1114
  const canvasSize = Math.max(width, height);
1104
- canvas.setAttribute("width", `${canvasSize}`);
1105
- canvas.setAttribute("height", `${canvasSize}`);
1115
+ const size = Math.min(canvasSize, maxSize);
1116
+ canvas.style.top = `${offset}px`;
1117
+ canvas.setAttribute("width", `${size}`);
1118
+ canvas.setAttribute("height", `${size}`);
1106
1119
  }, []);
1107
1120
  return {
1108
1121
  canvasRef,
@@ -1112,8 +1125,20 @@ var useResizedCanvasRef = () => {
1112
1125
 
1113
1126
  // src/loading-spiral/LoadingSpiral.tsx
1114
1127
  var LoadingSpiral = (props) => {
1115
- const { canvasRef, containerRef } = useResizedCanvasRef();
1116
- const _a = props, { className, canvas, step } = _a, rest = __objRest(_a, ["className", "canvas", "step"]);
1128
+ const _a = props || {}, {
1129
+ className,
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);
1117
1142
  useEffect4(() => {
1118
1143
  if (!canvasRef.current) {
1119
1144
  return;
@@ -1127,7 +1152,8 @@ var LoadingSpiral = (props) => {
1127
1152
  className: classNames7("fixed h-full w-full overflow-hidden flex justify-center items-center", className),
1128
1153
  ref: containerRef
1129
1154
  }, /* @__PURE__ */ React21.createElement("canvas", {
1130
- ref: canvasRef
1155
+ ref: canvasRef,
1156
+ className: "relative"
1131
1157
  }));
1132
1158
  };
1133
1159
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.5.26",
3
+ "version": "1.5.29",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",