@surdeddd/bottom-sheet 0.14.0 → 0.20.0
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/README.md +13 -0
- package/dist/{BottomSheetCore-DJYwWOqt.d.ts → BottomSheetCore-Cgn8b_6A.d.ts} +11 -2
- package/dist/{BottomSheetCore-Cp7dWy91.d.cts → BottomSheetCore-VPJZcKcg.d.cts} +11 -2
- package/dist/{BottomSheetEngine-Lm7HIVHv.d.cts → BottomSheetEngine-B8C2CwF9.d.cts} +1 -1
- package/dist/{BottomSheetEngine-O5PbeKfe.d.ts → BottomSheetEngine-DwYR_ygJ.d.ts} +1 -1
- package/dist/core.cjs +100 -9
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +100 -9
- package/dist/debug.d.cts +1 -1
- package/dist/debug.d.ts +1 -1
- package/dist/element.cjs +107 -9
- package/dist/element.d.cts +2 -2
- package/dist/element.d.ts +2 -2
- package/dist/element.iife.global.js +2 -2
- package/dist/element.js +107 -9
- package/dist/features.d.cts +4 -4
- package/dist/features.d.ts +4 -4
- package/dist/{index-Bb5TRmyg.d.cts → index-CnfbOKx0.d.cts} +1 -1
- package/dist/{index-Cl9ebCP2.d.ts → index-DcMkhXAy.d.ts} +1 -1
- package/dist/index.cjs +100 -9
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +100 -9
- package/dist/integrations/formik.d.cts +1 -1
- package/dist/integrations/formik.d.ts +1 -1
- package/dist/integrations/react-hook-form.d.cts +1 -1
- package/dist/integrations/react-hook-form.d.ts +1 -1
- package/dist/preact.d.cts +2 -2
- package/dist/preact.d.ts +2 -2
- package/dist/qwik-lib/index.qwik.cjs +98 -9
- package/dist/qwik-lib/index.qwik.mjs +98 -9
- package/dist/qwik.cjs +100 -9
- package/dist/qwik.d.cts +2 -2
- package/dist/qwik.d.ts +2 -2
- package/dist/qwik.js +100 -9
- package/dist/react.cjs +100 -9
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +100 -9
- package/dist/solid.cjs +100 -9
- package/dist/solid.d.cts +10 -1
- package/dist/solid.d.ts +10 -1
- package/dist/solid.js +100 -9
- package/dist/solid.source.jsx +100 -9
- package/dist/svelte-core.cjs +100 -9
- package/dist/svelte-core.js +100 -9
- package/dist/svelte.cjs +100 -9
- package/dist/svelte.js +100 -9
- package/dist/vue.cjs +100 -9
- package/dist/vue.js +100 -9
- package/dist/webgl.cjs +104 -14
- package/dist/webgl.d.cts +1 -1
- package/dist/webgl.d.ts +1 -1
- package/dist/webgl.js +104 -14
- package/package.json +39 -39
package/dist/webgl.js
CHANGED
|
@@ -271,6 +271,59 @@ var wrapLines = (ctx, text, maxWidth) => {
|
|
|
271
271
|
lines.push(line);
|
|
272
272
|
return lines;
|
|
273
273
|
};
|
|
274
|
+
var isPaintedColor = (value) => !!value && value !== "transparent" && !/rgba\(\s*0,\s*0,\s*0,\s*0\s*\)/.test(value);
|
|
275
|
+
var roundedPath = (ctx, x, y, w, h, r) => {
|
|
276
|
+
const rad = Math.min(r, w / 2, h / 2);
|
|
277
|
+
ctx.beginPath();
|
|
278
|
+
if (rad <= 0) {
|
|
279
|
+
ctx.rect(x, y, w, h);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
ctx.moveTo(x + rad, y);
|
|
283
|
+
ctx.arcTo(x + w, y, x + w, y + h, rad);
|
|
284
|
+
ctx.arcTo(x + w, y + h, x, y + h, rad);
|
|
285
|
+
ctx.arcTo(x, y + h, x, y, rad);
|
|
286
|
+
ctx.arcTo(x, y, x + w, y, rad);
|
|
287
|
+
ctx.closePath();
|
|
288
|
+
};
|
|
289
|
+
var drawBox = (ctx, cs, rect, rootRect) => {
|
|
290
|
+
const bg = cs.backgroundColor;
|
|
291
|
+
const borderWidth = parseFloat(cs.borderTopWidth) || 0;
|
|
292
|
+
const hasBorder = borderWidth > 0 && isPaintedColor(cs.borderTopColor);
|
|
293
|
+
if (!isPaintedColor(bg) && !hasBorder) return false;
|
|
294
|
+
const x = rect.left - rootRect.left;
|
|
295
|
+
const y = rect.top - rootRect.top;
|
|
296
|
+
const radius = parseFloat(cs.borderTopLeftRadius) || 0;
|
|
297
|
+
if (isPaintedColor(bg)) {
|
|
298
|
+
roundedPath(ctx, x, y, rect.width, rect.height, radius);
|
|
299
|
+
ctx.fillStyle = bg;
|
|
300
|
+
ctx.fill();
|
|
301
|
+
}
|
|
302
|
+
if (hasBorder) {
|
|
303
|
+
roundedPath(ctx, x, y, rect.width, rect.height, radius);
|
|
304
|
+
ctx.strokeStyle = cs.borderTopColor;
|
|
305
|
+
ctx.lineWidth = borderWidth;
|
|
306
|
+
ctx.stroke();
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
};
|
|
310
|
+
var drawImage = (ctx, img, rootRect) => {
|
|
311
|
+
if (!img.complete || img.naturalWidth === 0) return false;
|
|
312
|
+
const rect = img.getBoundingClientRect();
|
|
313
|
+
if (rect.width < 1 || rect.height < 1) return false;
|
|
314
|
+
try {
|
|
315
|
+
ctx.drawImage(
|
|
316
|
+
img,
|
|
317
|
+
rect.left - rootRect.left,
|
|
318
|
+
rect.top - rootRect.top,
|
|
319
|
+
rect.width,
|
|
320
|
+
rect.height
|
|
321
|
+
);
|
|
322
|
+
return true;
|
|
323
|
+
} catch {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
};
|
|
274
327
|
var captureContent = (gl, root, dpr) => {
|
|
275
328
|
const rootRect = root.getBoundingClientRect();
|
|
276
329
|
const w = Math.max(1, Math.round(rootRect.width * dpr));
|
|
@@ -287,12 +340,24 @@ var captureContent = (gl, root, dpr) => {
|
|
|
287
340
|
let painted = 0;
|
|
288
341
|
while (walker.nextNode()) {
|
|
289
342
|
const el = walker.currentNode;
|
|
343
|
+
if (el.tagName === "IMG") {
|
|
344
|
+
if (drawImage(ctx, el, rootRect)) {
|
|
345
|
+
painted++;
|
|
346
|
+
hiddenNodes.push(el);
|
|
347
|
+
}
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
290
350
|
if (!isRenderable(el)) continue;
|
|
291
|
-
const text = directText(el);
|
|
292
|
-
if (!text) continue;
|
|
293
351
|
const rect = el.getBoundingClientRect();
|
|
294
352
|
if (rect.width < 1 || rect.height < 1) continue;
|
|
295
353
|
const cs = getComputedStyle(el);
|
|
354
|
+
const boxed = drawBox(ctx, cs, rect, rootRect);
|
|
355
|
+
if (boxed) {
|
|
356
|
+
painted++;
|
|
357
|
+
hiddenNodes.push(el);
|
|
358
|
+
}
|
|
359
|
+
const text = directText(el);
|
|
360
|
+
if (!text) continue;
|
|
296
361
|
ctx.font = `${cs.fontStyle} ${cs.fontWeight} ${cs.fontSize} ${cs.fontFamily}`;
|
|
297
362
|
ctx.fillStyle = cs.color;
|
|
298
363
|
ctx.textBaseline = "top";
|
|
@@ -319,7 +384,7 @@ var captureContent = (gl, root, dpr) => {
|
|
|
319
384
|
});
|
|
320
385
|
if (lines.length) {
|
|
321
386
|
painted++;
|
|
322
|
-
hiddenNodes.push(el);
|
|
387
|
+
if (!boxed) hiddenNodes.push(el);
|
|
323
388
|
}
|
|
324
389
|
}
|
|
325
390
|
if (!painted) return null;
|
|
@@ -327,14 +392,19 @@ var captureContent = (gl, root, dpr) => {
|
|
|
327
392
|
if (!texture) return null;
|
|
328
393
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
329
394
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
|
330
|
-
|
|
331
|
-
gl.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
395
|
+
try {
|
|
396
|
+
gl.texImage2D(
|
|
397
|
+
gl.TEXTURE_2D,
|
|
398
|
+
0,
|
|
399
|
+
gl.RGBA,
|
|
400
|
+
gl.RGBA,
|
|
401
|
+
gl.UNSIGNED_BYTE,
|
|
402
|
+
surface
|
|
403
|
+
);
|
|
404
|
+
} catch {
|
|
405
|
+
gl.deleteTexture(texture);
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
338
408
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
339
409
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
340
410
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
@@ -342,10 +412,30 @@ var captureContent = (gl, root, dpr) => {
|
|
|
342
412
|
return { texture, width: w, height: h, hiddenNodes };
|
|
343
413
|
};
|
|
344
414
|
var hideCapturedText = (nodes) => {
|
|
345
|
-
const restore = nodes.map((el) => ({
|
|
346
|
-
|
|
415
|
+
const restore = nodes.map((el) => ({
|
|
416
|
+
el,
|
|
417
|
+
color: el.style.color,
|
|
418
|
+
background: el.style.background,
|
|
419
|
+
borderColor: el.style.borderColor,
|
|
420
|
+
opacity: el.style.opacity,
|
|
421
|
+
isImage: el.tagName === "IMG"
|
|
422
|
+
}));
|
|
423
|
+
for (const entry of restore) {
|
|
424
|
+
if (entry.isImage) {
|
|
425
|
+
entry.el.style.opacity = "0";
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
entry.el.style.color = "transparent";
|
|
429
|
+
entry.el.style.background = "transparent";
|
|
430
|
+
entry.el.style.borderColor = "transparent";
|
|
431
|
+
}
|
|
347
432
|
return () => {
|
|
348
|
-
for (const
|
|
433
|
+
for (const entry of restore) {
|
|
434
|
+
entry.el.style.color = entry.color;
|
|
435
|
+
entry.el.style.background = entry.background;
|
|
436
|
+
entry.el.style.borderColor = entry.borderColor;
|
|
437
|
+
entry.el.style.opacity = entry.opacity;
|
|
438
|
+
}
|
|
349
439
|
};
|
|
350
440
|
};
|
|
351
441
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surdeddd/bottom-sheet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Universal, headless bottom sheet — framework-agnostic core with React, Vue 3, Svelte, Solid, Qwik, Preact, Lit and Custom Element adapters. Pointer Events, snap points, momentum, a11y, SSR-safe.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -216,37 +216,37 @@
|
|
|
216
216
|
{
|
|
217
217
|
"name": "core (engine + types)",
|
|
218
218
|
"path": "dist/index.js",
|
|
219
|
-
"limit": "21.
|
|
219
|
+
"limit": "21.74 KB",
|
|
220
220
|
"gzip": true
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
"name": "react adapter",
|
|
224
224
|
"path": "dist/react.js",
|
|
225
|
-
"limit": "29 KB",
|
|
225
|
+
"limit": "29.16 KB",
|
|
226
226
|
"gzip": true
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"name": "vue adapter",
|
|
230
230
|
"path": "dist/vue.js",
|
|
231
|
-
"limit": "24.
|
|
231
|
+
"limit": "24.98 KB",
|
|
232
232
|
"gzip": true
|
|
233
233
|
},
|
|
234
234
|
{
|
|
235
235
|
"name": "svelte adapter",
|
|
236
236
|
"path": "dist/svelte.js",
|
|
237
|
-
"limit": "24.
|
|
237
|
+
"limit": "24.59 KB",
|
|
238
238
|
"gzip": true
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
241
|
"name": "solid adapter",
|
|
242
242
|
"path": "dist/solid.js",
|
|
243
|
-
"limit": "23 KB",
|
|
243
|
+
"limit": "23.23 KB",
|
|
244
244
|
"gzip": true
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
247
|
"name": "qwik adapter",
|
|
248
248
|
"path": "dist/qwik.js",
|
|
249
|
-
"limit": "23 KB",
|
|
249
|
+
"limit": "23.25 KB",
|
|
250
250
|
"gzip": true
|
|
251
251
|
},
|
|
252
252
|
{
|
|
@@ -261,13 +261,13 @@
|
|
|
261
261
|
{
|
|
262
262
|
"name": "web component (self-contained)",
|
|
263
263
|
"path": "dist/element.js",
|
|
264
|
-
"limit": "28 KB",
|
|
264
|
+
"limit": "28.35 KB",
|
|
265
265
|
"gzip": true
|
|
266
266
|
},
|
|
267
267
|
{
|
|
268
268
|
"name": "web component (IIFE / CDN)",
|
|
269
269
|
"path": "dist/element.iife.global.js",
|
|
270
|
-
"limit": "27.
|
|
270
|
+
"limit": "27.9 KB",
|
|
271
271
|
"gzip": true
|
|
272
272
|
},
|
|
273
273
|
{
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
{
|
|
286
286
|
"name": "slim core (subpath, no optional features)",
|
|
287
287
|
"path": "dist/core.js",
|
|
288
|
-
"limit": "19.
|
|
288
|
+
"limit": "19.85 KB",
|
|
289
289
|
"gzip": true
|
|
290
290
|
},
|
|
291
291
|
{
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
{
|
|
298
298
|
"name": "webgl renderer (subpath)",
|
|
299
299
|
"path": "dist/webgl.js",
|
|
300
|
-
"limit": "
|
|
300
|
+
"limit": "5 KB",
|
|
301
301
|
"gzip": true
|
|
302
302
|
}
|
|
303
303
|
],
|
|
@@ -380,45 +380,45 @@
|
|
|
380
380
|
"seroval-plugins": "^1.5.6"
|
|
381
381
|
},
|
|
382
382
|
"devDependencies": {
|
|
383
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
384
|
-
"@axe-core/playwright": "^4.
|
|
385
|
-
"@builder.io/qwik": "^1.
|
|
383
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
384
|
+
"@axe-core/playwright": "^4.12.1",
|
|
385
|
+
"@builder.io/qwik": "^1.20.0",
|
|
386
386
|
"@lhci/cli": "^0.15.1",
|
|
387
|
-
"@playwright/test": "^1.
|
|
387
|
+
"@playwright/test": "^1.62.1",
|
|
388
388
|
"@size-limit/preset-small-lib": "^12.1.0",
|
|
389
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
390
|
-
"@types/node": "^20.
|
|
391
|
-
"@types/react": "^18.
|
|
392
|
-
"@types/react-dom": "^18.
|
|
389
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
390
|
+
"@types/node": "^20.19.43",
|
|
391
|
+
"@types/react": "^18.3.31",
|
|
392
|
+
"@types/react-dom": "^18.3.7",
|
|
393
393
|
"@types/three": "^0.185.1",
|
|
394
|
-
"@vitejs/plugin-react": "^
|
|
395
|
-
"@vitejs/plugin-vue": "^
|
|
396
|
-
"@vitest/coverage-v8": "^1.
|
|
394
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
395
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
396
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
397
397
|
"esbuild-plugin-solid": "^0.6.0",
|
|
398
|
-
"esbuild-svelte": "
|
|
399
|
-
"fast-check": "^4.
|
|
400
|
-
"happy-dom": "^
|
|
398
|
+
"esbuild-svelte": "0.9.4",
|
|
399
|
+
"fast-check": "^4.9.0",
|
|
400
|
+
"happy-dom": "^20.11.1",
|
|
401
401
|
"husky": "^9.1.7",
|
|
402
|
-
"lit": "^3.3.
|
|
403
|
-
"motion": "^12.
|
|
402
|
+
"lit": "^3.3.3",
|
|
403
|
+
"motion": "^12.43.0",
|
|
404
404
|
"patch-package": "^8.0.1",
|
|
405
|
-
"publint": "^0.3.
|
|
406
|
-
"react": "^18.
|
|
407
|
-
"react-dom": "^18.
|
|
408
|
-
"rolldown": "^1.
|
|
405
|
+
"publint": "^0.3.22",
|
|
406
|
+
"react": "^18.3.1",
|
|
407
|
+
"react-dom": "^18.3.1",
|
|
408
|
+
"rolldown": "^1.2.1",
|
|
409
409
|
"size-limit": "^12.1.0",
|
|
410
|
-
"solid-js": "^1.9.
|
|
411
|
-
"svelte": "^5.
|
|
410
|
+
"solid-js": "^1.9.14",
|
|
411
|
+
"svelte": "^5.56.8",
|
|
412
412
|
"three": "^0.185.1",
|
|
413
|
-
"tsup": "^8.
|
|
413
|
+
"tsup": "^8.5.1",
|
|
414
414
|
"typedoc": "^0.28.20",
|
|
415
415
|
"typescript": "^5.9.3",
|
|
416
416
|
"unplugin-vue": "^7.2.0",
|
|
417
|
-
"vite": "^
|
|
418
|
-
"vite-plugin-solid": "^2.11.
|
|
419
|
-
"vitest": "^1.
|
|
420
|
-
"vue": "^3.
|
|
421
|
-
"vue-tsc": "^
|
|
417
|
+
"vite": "^7.3.6",
|
|
418
|
+
"vite-plugin-solid": "^2.11.14",
|
|
419
|
+
"vitest": "^4.1.10",
|
|
420
|
+
"vue": "^3.5.40",
|
|
421
|
+
"vue-tsc": "^3.3.9"
|
|
422
422
|
},
|
|
423
423
|
"engines": {
|
|
424
424
|
"node": ">=20"
|