@bbki.ng/components 2.1.23 → 2.1.26

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.cjs CHANGED
@@ -1122,7 +1122,7 @@ var Gallery = (props) => {
1122
1122
  // lib/loading-spiral/LoadingSpiral.tsx
1123
1123
  var import_phenomenon = __toESM(require("phenomenon"), 1);
1124
1124
  var import_classnames13 = __toESM(require("classnames"), 1);
1125
- var import_react23 = __toESM(require("react"), 1);
1125
+ var import_react22 = __toESM(require("react"), 1);
1126
1126
 
1127
1127
  // lib/loading-spiral/createSettings.ts
1128
1128
  var createSettings = (settings) => {
@@ -1147,10 +1147,7 @@ var createSettings = (settings) => {
1147
1147
 
1148
1148
  // lib/loading-spiral/constants.ts
1149
1149
  var VERTEX_SHADER = `
1150
- attribute vec3 ${"aColor" /* COLOR */};
1151
- attribute float ${"aOffsetY" /* OFFSET_Y */};
1152
1150
  attribute float ${"aPercent" /* PERCENT */};
1153
- attribute float ${"aLength" /* LENGTH */};
1154
1151
  attribute float ${"aPointSize" /* POINT_SIZE */};
1155
1152
 
1156
1153
  uniform mat4 uProjectionMatrix;
@@ -1188,75 +1185,35 @@ var VERTEX_SHADER = `
1188
1185
  );
1189
1186
  }
1190
1187
 
1191
- mat4 translateY(float _offset){
1192
- return mat4(
1193
- 1.0, 0.0, 0.0, 0.0,
1194
- 0.0, 1.0, 0.0, -1.0 * _offset,
1195
- 0.0, 0.0, 1.0, 0.0,
1196
- 0.0, 0.0, 0.0, 1.0
1197
- );
1198
- }
1199
-
1200
1188
  void main(){
1201
1189
  gl_Position = uProjectionMatrix
1202
1190
  * uModelMatrix
1203
1191
  * uViewMatrix
1204
1192
  * rotateX(uProgress)
1205
- * vec4(curve(${"aPercent" /* PERCENT */}, ${"aLength" /* LENGTH */}), 1.0)
1206
- * translateY(${"aOffsetY" /* OFFSET_Y */});
1193
+ * vec4(curve(${"aPercent" /* PERCENT */}, 0.8), 1.0);
1207
1194
 
1208
1195
  gl_PointSize = ${"aPointSize" /* POINT_SIZE */};
1209
- vColor = ${"aColor" /* COLOR */};
1210
1196
  }
1211
1197
  `;
1212
1198
  var FRAGMENT_SHADER = `
1213
1199
  precision mediump float;
1214
1200
  uniform float uProgress;
1215
- varying vec3 vColor;
1216
1201
  void main(){
1217
- gl_FragColor = vec4(vColor, 1.0);
1202
+ gl_FragColor = vec4(0.81, 0.83, 0.85, 1.0);
1218
1203
  }
1219
1204
  `;
1220
1205
 
1221
- // lib/loading-spiral/utils.ts
1222
- var rgba = (val) => {
1223
- const [r, g, b, a] = val;
1224
- return [r / 255, g / 255, b / 255, a];
1225
- };
1226
-
1227
1206
  // lib/loading-spiral/createOptions.ts
1228
- var DEFAULT_OPT = {
1229
- multiplier: 5e3,
1230
- color: [209, 213, 219, 1],
1231
- offset: -0.3,
1232
- length: 0.3
1233
- };
1234
- var createOptions = (opt = DEFAULT_OPT) => {
1235
- const { multiplier, color, length, offset = -1 * 0.3 } = opt;
1207
+ var createOptions = () => {
1236
1208
  const attributes = [
1237
1209
  {
1238
1210
  name: "aPercent" /* PERCENT */,
1239
1211
  data: (i, total) => [i / total],
1240
1212
  size: 1
1241
1213
  },
1242
- {
1243
- name: "aLength" /* LENGTH */,
1244
- data: () => [length],
1245
- size: 1
1246
- },
1247
- {
1248
- name: "aColor" /* COLOR */,
1249
- data: () => rgba(color),
1250
- size: 3
1251
- },
1252
- {
1253
- name: "aOffsetY" /* OFFSET_Y */,
1254
- data: () => [offset],
1255
- size: 1
1256
- },
1257
1214
  {
1258
1215
  name: "aPointSize" /* POINT_SIZE */,
1259
- data: () => [window.devicePixelRatio * 1.5],
1216
+ data: () => [window.devicePixelRatio * 1.3],
1260
1217
  size: 1
1261
1218
  }
1262
1219
  ];
@@ -1269,39 +1226,17 @@ var createOptions = (opt = DEFAULT_OPT) => {
1269
1226
  return {
1270
1227
  uniforms,
1271
1228
  attributes,
1272
- multiplier,
1229
+ multiplier: 4e3,
1273
1230
  vertex: VERTEX_SHADER,
1274
1231
  fragment: FRAGMENT_SHADER
1275
1232
  };
1276
1233
  };
1277
1234
 
1278
- // lib/loading-spiral/useCanvasRef.ts
1279
- var import_react22 = require("react");
1280
- var useResizedCanvasRef = (maxSize) => {
1281
- const canvasRef = (0, import_react22.useRef)(null);
1282
- const containerRef = (0, import_react22.useRef)(null);
1283
- (0, import_react22.useEffect)(() => {
1284
- const canvas = canvasRef.current;
1285
- const container = containerRef.current;
1286
- if (!canvas || !container)
1287
- return;
1288
- const { width, height } = container.getBoundingClientRect();
1289
- const canvasSize = Math.min(width, height);
1290
- const size = Math.min(canvasSize, maxSize);
1291
- canvas.setAttribute("width", `${size}`);
1292
- canvas.setAttribute("height", `${size}`);
1293
- }, []);
1294
- return {
1295
- canvasRef,
1296
- containerRef
1297
- };
1298
- };
1299
-
1300
1235
  // lib/loading-spiral/LoadingSpiral.tsx
1301
1236
  var LoadingSpiral = (props) => {
1302
- const { className, canvas, step, maxWidth = 1e3, ...rest } = props || {};
1303
- const { canvasRef, containerRef } = useResizedCanvasRef(maxWidth);
1304
- (0, import_react23.useEffect)(() => {
1237
+ const { className, step } = props || {};
1238
+ const canvasRef = (0, import_react22.useRef)(null);
1239
+ (0, import_react22.useEffect)(() => {
1305
1240
  if (!canvasRef.current) {
1306
1241
  return;
1307
1242
  }
@@ -1313,13 +1248,20 @@ var LoadingSpiral = (props) => {
1313
1248
  });
1314
1249
  phenomenon.add(
1315
1250
  "spiral",
1316
- createOptions(Object.assign({}, DEFAULT_OPT, rest))
1251
+ createOptions()
1317
1252
  );
1318
1253
  }, []);
1319
- return /* @__PURE__ */ import_react23.default.createElement("canvas", {
1254
+ return /* @__PURE__ */ import_react22.default.createElement("canvas", {
1255
+ width: 200,
1256
+ height: 200,
1257
+ style: {
1258
+ width: 200,
1259
+ height: 200,
1260
+ imageRendering: "pixelated"
1261
+ },
1320
1262
  ref: canvasRef,
1321
1263
  className: (0, import_classnames13.default)(
1322
- "h-full w-full overflow-hidden flex justify-center items-center",
1264
+ "h-full w-full overflow-hidden flex justify-center items-center aspect-1",
1323
1265
  className
1324
1266
  )
1325
1267
  });