@bbki.ng/components 1.5.27 → 1.5.28

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
@@ -276,7 +276,9 @@ 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
283
  declare const LoadingSpiral: (props?: LoadingSpiralProps | undefined) => JSX.Element;
282
284
 
package/dist/index.js CHANGED
@@ -1081,8 +1081,16 @@ 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.04,
1087
+ 0.0, 1.0, 0.0, cos(_angle) * 0.04,
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);
1093
+ gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
1086
1094
  gl_PointSize = 2.0;
1087
1095
  vColor = ${"aColor" /* COLOR */};
1088
1096
  }
@@ -1149,7 +1157,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1149
1157
 
1150
1158
  // src/loading-spiral/useCanvasRef.ts
1151
1159
  var import_react22 = require("react");
1152
- var useResizedCanvasRef = () => {
1160
+ var useResizedCanvasRef = (maxSize, offset) => {
1153
1161
  const canvasRef = (0, import_react22.useRef)(null);
1154
1162
  const containerRef = (0, import_react22.useRef)(null);
1155
1163
  (0, import_react22.useEffect)(() => {
@@ -1159,8 +1167,10 @@ var useResizedCanvasRef = () => {
1159
1167
  return;
1160
1168
  const { width, height } = container.getBoundingClientRect();
1161
1169
  const canvasSize = Math.max(width, height);
1162
- canvas.setAttribute("width", `${canvasSize}`);
1163
- canvas.setAttribute("height", `${canvasSize}`);
1170
+ const size = Math.min(canvasSize, maxSize);
1171
+ canvas.style.top = `${offset}px`;
1172
+ canvas.setAttribute("width", `${size}`);
1173
+ canvas.setAttribute("height", `${size}`);
1164
1174
  }, []);
1165
1175
  return {
1166
1176
  canvasRef,
@@ -1170,8 +1180,20 @@ var useResizedCanvasRef = () => {
1170
1180
 
1171
1181
  // src/loading-spiral/LoadingSpiral.tsx
1172
1182
  var LoadingSpiral = (props) => {
1173
- const { canvasRef, containerRef } = useResizedCanvasRef();
1174
- const _a = props || {}, { className, canvas, step } = _a, rest = __objRest(_a, ["className", "canvas", "step"]);
1183
+ const _a = props || {}, {
1184
+ className,
1185
+ canvas,
1186
+ step,
1187
+ maxWidth = 1e3,
1188
+ offset = -100
1189
+ } = _a, rest = __objRest(_a, [
1190
+ "className",
1191
+ "canvas",
1192
+ "step",
1193
+ "maxWidth",
1194
+ "offset"
1195
+ ]);
1196
+ const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth, offset);
1175
1197
  (0, import_react23.useEffect)(() => {
1176
1198
  if (!canvasRef.current) {
1177
1199
  return;
@@ -1185,7 +1207,8 @@ var LoadingSpiral = (props) => {
1185
1207
  className: (0, import_classnames13.default)("fixed h-full w-full overflow-hidden flex justify-center items-center", className),
1186
1208
  ref: containerRef
1187
1209
  }, /* @__PURE__ */ import_react23.default.createElement("canvas", {
1188
- ref: canvasRef
1210
+ ref: canvasRef,
1211
+ className: "relative"
1189
1212
  }));
1190
1213
  };
1191
1214
  module.exports = __toCommonJS(src_exports);
package/dist/index.mjs CHANGED
@@ -1023,8 +1023,16 @@ 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.04,
1029
+ 0.0, 1.0, 0.0, cos(_angle) * 0.04,
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);
1035
+ gl_Position = rotate(uProgress) * uProjectionMatrix * uModelMatrix * uViewMatrix * vec4(${"aPositionStart" /* POSITION_START */}, 1.0) * translate(uProgress);
1028
1036
  gl_PointSize = 2.0;
1029
1037
  vColor = ${"aColor" /* COLOR */};
1030
1038
  }
@@ -1091,7 +1099,7 @@ var createOptions = (opt = DEFAULT_OPT) => {
1091
1099
 
1092
1100
  // src/loading-spiral/useCanvasRef.ts
1093
1101
  import { useEffect as useEffect3, useRef as useRef2 } from "react";
1094
- var useResizedCanvasRef = () => {
1102
+ var useResizedCanvasRef = (maxSize, offset) => {
1095
1103
  const canvasRef = useRef2(null);
1096
1104
  const containerRef = useRef2(null);
1097
1105
  useEffect3(() => {
@@ -1101,8 +1109,10 @@ var useResizedCanvasRef = () => {
1101
1109
  return;
1102
1110
  const { width, height } = container.getBoundingClientRect();
1103
1111
  const canvasSize = Math.max(width, height);
1104
- canvas.setAttribute("width", `${canvasSize}`);
1105
- canvas.setAttribute("height", `${canvasSize}`);
1112
+ const size = Math.min(canvasSize, maxSize);
1113
+ canvas.style.top = `${offset}px`;
1114
+ canvas.setAttribute("width", `${size}`);
1115
+ canvas.setAttribute("height", `${size}`);
1106
1116
  }, []);
1107
1117
  return {
1108
1118
  canvasRef,
@@ -1112,8 +1122,20 @@ var useResizedCanvasRef = () => {
1112
1122
 
1113
1123
  // src/loading-spiral/LoadingSpiral.tsx
1114
1124
  var LoadingSpiral = (props) => {
1115
- const { canvasRef, containerRef } = useResizedCanvasRef();
1116
- const _a = props || {}, { className, canvas, step } = _a, rest = __objRest(_a, ["className", "canvas", "step"]);
1125
+ const _a = props || {}, {
1126
+ className,
1127
+ canvas,
1128
+ step,
1129
+ maxWidth = 1e3,
1130
+ offset = -100
1131
+ } = _a, rest = __objRest(_a, [
1132
+ "className",
1133
+ "canvas",
1134
+ "step",
1135
+ "maxWidth",
1136
+ "offset"
1137
+ ]);
1138
+ const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth, offset);
1117
1139
  useEffect4(() => {
1118
1140
  if (!canvasRef.current) {
1119
1141
  return;
@@ -1127,7 +1149,8 @@ var LoadingSpiral = (props) => {
1127
1149
  className: classNames7("fixed h-full w-full overflow-hidden flex justify-center items-center", className),
1128
1150
  ref: containerRef
1129
1151
  }, /* @__PURE__ */ React21.createElement("canvas", {
1130
- ref: canvasRef
1152
+ ref: canvasRef,
1153
+ className: "relative"
1131
1154
  }));
1132
1155
  };
1133
1156
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/components",
3
- "version": "1.5.27",
3
+ "version": "1.5.28",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",