@shibui-ui/ui 1.24.1 → 1.25.1
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/components/atoms/index.d.ts +45 -16
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/molecules/index.d.ts +20 -1
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +17 -1
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/index.d.ts +3 -82
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -80
- package/dist/index.js.map +1 -1
- package/dist/index10.js +82 -18
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +84 -69
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +40 -26
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +16 -39
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +29 -44
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +16 -117
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +48 -40
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +41 -25
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +76 -49
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +19 -39
- package/dist/index19.js.map +1 -1
- package/dist/index194.js +94 -24
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +2 -2
- package/dist/index197.js +2 -24
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +74 -2
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +64 -35
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +21 -41
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index201.js +54 -13
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +2 -2
- package/dist/index203.js +2 -2
- package/dist/index204.js +143 -157
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +43 -24
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +51 -2
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +2 -11
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +33 -2
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +2 -91
- package/dist/index209.js.map +1 -1
- package/dist/index21.js +90 -26
- package/dist/index21.js.map +1 -1
- package/dist/index210.js +6 -2
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +2 -41
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +260 -2
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +16 -5
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +2 -2
- package/dist/index215.js +2 -35
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +59 -42
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +32 -2
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +2 -85
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +2 -2
- package/dist/index22.js +41 -48
- package/dist/index22.js.map +1 -1
- package/dist/index220.js +73 -65
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +81 -2
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +2 -10
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +133 -2
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +2 -26
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +2 -2
- package/dist/index226.js +66 -12
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +97 -2
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +2 -2
- package/dist/index229.js +62 -24
- package/dist/index229.js.map +1 -1
- package/dist/index23.js +50 -94
- package/dist/index23.js.map +1 -1
- package/dist/index230.js +2 -2
- package/dist/index231.js +2 -2
- package/dist/index232.js +12 -2
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +5 -16
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -2
- package/dist/index235.js +11 -9
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +2 -2
- package/dist/index237.js +76 -34
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +2 -2
- package/dist/index239.js +2 -27
- package/dist/index239.js.map +1 -1
- package/dist/index24.js +37 -34
- package/dist/index24.js.map +1 -1
- package/dist/index240.js +39 -2
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +2 -34
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +235 -12
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +82 -2
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +2 -9
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +94 -2
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +2 -5
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +268 -2
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +2 -36
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +21 -2
- package/dist/index249.js.map +1 -1
- package/dist/index25.js +51 -32
- package/dist/index25.js.map +1 -1
- package/dist/index250.js +2 -31
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +9 -2
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +2 -19
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +15 -2
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +2 -2
- package/dist/index255.js +135 -69
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -11
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +5 -2
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +2 -78
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +9 -2
- package/dist/index259.js.map +1 -1
- package/dist/index26.js +31 -236
- package/dist/index26.js.map +1 -1
- package/dist/index260.js +2 -32
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +2 -2
- package/dist/index262.js +92 -9
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +59 -2
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +2 -16
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +41 -2
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +2 -16
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +34 -9
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +8 -54
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +2 -2
- package/dist/index27.js +27 -58
- package/dist/index27.js.map +1 -1
- package/dist/index270.js +42 -7
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +2 -2
- package/dist/index272.js +2 -34
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +16 -2
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +9 -2
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +6 -13
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +2 -2
- package/dist/index277.js +8 -15
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +2 -2
- package/dist/index279.js +55 -2
- package/dist/index279.js.map +1 -1
- package/dist/index28.js +247 -24
- package/dist/index28.js.map +1 -1
- package/dist/index280.js +2 -42
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +2 -100
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +20 -2
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +2 -97
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +33 -2
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +6 -27
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +2 -2
- package/dist/index287.js +9 -44
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +2 -2
- package/dist/index289.js +2 -33
- package/dist/index289.js.map +1 -1
- package/dist/index29.js +249 -39
- package/dist/index29.js.map +1 -1
- package/dist/index290.js +36 -2
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +2 -57
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +24 -2
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +2 -2
- package/dist/index294.js +26 -247
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +2 -2
- package/dist/index296.js +2 -72
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +42 -2
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +7 -56
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +2 -133
- package/dist/index299.js.map +1 -1
- package/dist/index30.js +32 -19
- package/dist/index30.js.map +1 -1
- package/dist/index300.js +30 -2
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +2 -12
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +34 -2
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +2 -162
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +26 -42
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +2 -81
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +10 -2
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +2 -71
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +2 -2
- package/dist/index309.js +19 -2
- package/dist/index309.js.map +1 -1
- package/dist/index31.js +96 -11
- package/dist/index31.js.map +1 -1
- package/dist/index310.js +2 -81
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +2 -2
- package/dist/index312.js +42 -2
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +2 -74
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +25 -67
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +2 -2
- package/dist/index316.js +9 -17
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +2 -2
- package/dist/index318.js +84 -32
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +2 -2
- package/dist/index32.js +40 -48
- package/dist/index32.js.map +1 -1
- package/dist/index320.js +68 -77
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +2 -2
- package/dist/index322.js +12 -148
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +1 -1
- package/dist/index324.js +28 -6
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +2 -2
- package/dist/index326.js +78 -87
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +2 -2
- package/dist/index328.js +78 -2
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +2 -237
- package/dist/index329.js.map +1 -1
- package/dist/index33.js +20 -56
- package/dist/index33.js.map +1 -1
- package/dist/index330.js +11 -6
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +2 -2
- package/dist/index332.js +18 -59
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +2 -2
- package/dist/index334.js +12 -5
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +2 -2
- package/dist/index336.js +2 -15
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +88 -2
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +24 -2
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +2 -92
- package/dist/index339.js.map +1 -1
- package/dist/index34.js +59 -35
- package/dist/index34.js.map +1 -1
- package/dist/index340.js +42 -14
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +2 -2
- package/dist/index342.js +22 -80
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +2 -2
- package/dist/index344.js +2 -18
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +16 -2
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +2 -268
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +176 -2
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +2 -2
- package/dist/index349.js +35 -39
- package/dist/index349.js.map +1 -1
- package/dist/index35.js +101 -28
- package/dist/index35.js.map +1 -1
- package/dist/index350.js +3 -3
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +2 -2
- package/dist/index352.js +19 -26
- package/dist/index352.js.map +1 -1
- package/dist/index357.js +26 -19
- package/dist/index357.js.map +1 -1
- package/dist/index36.js +115 -33
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +41 -115
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +34 -246
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +30 -137
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +26 -84
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +26 -400
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +28 -77
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +23 -26
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +36 -33
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +62 -16
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +138 -21
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +129 -22
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +41 -19
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +11 -82
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +56 -279
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +21 -34
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +280 -33
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +74 -94
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +66 -41
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +333 -62
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +96 -256
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +38 -130
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +251 -50
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +144 -115
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +93 -183
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +33 -339
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +2 -2
- package/dist/index60.js +102 -66
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +73 -179
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +117 -97
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +113 -263
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +258 -251
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +177 -79
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +261 -140
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +183 -100
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +28 -89
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +20 -161
- package/dist/index69.js.map +1 -1
- package/dist/index7.js +394 -32
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +190 -53
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +204 -112
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +2 -2
- package/dist/index73.js +89 -28
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +126 -63
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +122 -111
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +67 -64
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +112 -88
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +87 -16
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +151 -79
- package/dist/index79.js.map +1 -1
- package/dist/index8.js +25 -127
- package/dist/index8.js.map +1 -1
- package/dist/index80.js +104 -186
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +59 -20
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +17 -129
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +88 -217
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +64 -112
- package/dist/index84.js.map +1 -1
- package/dist/index9.js +30 -45
- package/dist/index9.js.map +1 -1
- package/dist/src/components/atoms/index.d.ts +45 -16
- package/dist/src/components/atoms/index.d.ts.map +1 -1
- package/dist/src/components/molecules/index.d.ts +20 -1
- package/dist/src/components/molecules/index.d.ts.map +1 -1
- package/dist/src/components/organisms/index.d.ts +17 -1
- package/dist/src/components/organisms/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -82
- package/dist/src/index.d.ts.map +1 -1
- package/dist/tokens.css +353 -7
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index29.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { unsafeCSS, css, LitElement } from "lit";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { property, query, customElement } from "lit/decorators.js";
|
|
3
|
+
import { buttonLiquidTemplate } from "./index314.js";
|
|
4
|
+
import liquidCss from "./index315.js";
|
|
5
|
+
import sharedTokens from "./index196.js";
|
|
6
|
+
import { LIQUID_PALETTES } from "./index316.js";
|
|
5
7
|
var __defProp = Object.defineProperty;
|
|
6
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -12,57 +14,265 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
14
|
if (kind && result) __defProp(target, key, result);
|
|
13
15
|
return result;
|
|
14
16
|
};
|
|
15
|
-
|
|
16
|
-
constructor() {
|
|
17
|
-
|
|
17
|
+
class WaterPhysics {
|
|
18
|
+
constructor(btn, canvas, water, ripple) {
|
|
19
|
+
this.fill = 0;
|
|
20
|
+
this.targetFill = 0;
|
|
21
|
+
this.fillSpeed = 0.032;
|
|
22
|
+
this.shimmerX = -1;
|
|
23
|
+
this.t = 0;
|
|
24
|
+
this.hovered = false;
|
|
25
|
+
this.raf = 0;
|
|
26
|
+
this.A = 3.5;
|
|
27
|
+
this.f1 = 0.038;
|
|
28
|
+
this.f2 = 0.063;
|
|
29
|
+
this.s1 = 1.8;
|
|
30
|
+
this.s2 = 1.2;
|
|
31
|
+
this.W = 0;
|
|
32
|
+
this.H = 0;
|
|
18
33
|
this.ripples = [];
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
this.btn = btn;
|
|
35
|
+
this.canvas = canvas;
|
|
36
|
+
this.ctx = canvas.getContext("2d");
|
|
37
|
+
[this.wr, this.wg, this.wb] = water;
|
|
38
|
+
[this.rr, this.rg, this.rb] = ripple;
|
|
39
|
+
this.resize();
|
|
40
|
+
this.loop();
|
|
41
|
+
}
|
|
42
|
+
/* ── Dimensiones con DPR ── */
|
|
43
|
+
resize() {
|
|
44
|
+
const r = this.btn.getBoundingClientRect();
|
|
45
|
+
const dpr = window.devicePixelRatio || 1;
|
|
46
|
+
this.W = r.width;
|
|
47
|
+
this.H = r.height;
|
|
48
|
+
this.canvas.width = this.W * dpr;
|
|
49
|
+
this.canvas.height = this.H * dpr;
|
|
50
|
+
this.canvas.style.width = `${this.W}px`;
|
|
51
|
+
this.canvas.style.height = `${this.H}px`;
|
|
52
|
+
this.ctx.scale(dpr, dpr);
|
|
53
|
+
}
|
|
54
|
+
/* ── Spawn de ripple ── */
|
|
55
|
+
spawnRipple(x, y, { speed = 2.2, maxR, lineWidth = 1.2 } = {}) {
|
|
56
|
+
const diag = Math.sqrt(this.W ** 2 + this.H ** 2);
|
|
57
|
+
this.ripples.push({
|
|
58
|
+
x,
|
|
59
|
+
y,
|
|
60
|
+
radius: 0,
|
|
61
|
+
maxRadius: maxR ?? diag * 0.72,
|
|
62
|
+
speed,
|
|
63
|
+
lineWidth,
|
|
64
|
+
opacity: 0
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/* ── Eventos públicos — llamados por el componente Lit ── */
|
|
68
|
+
onMouseEnter(x, y) {
|
|
69
|
+
this.hovered = true;
|
|
70
|
+
this.targetFill = 1;
|
|
71
|
+
this.fillSpeed = 0.028;
|
|
72
|
+
this.shimmerX = -0.3;
|
|
73
|
+
this.spawnRipple(x, y, { speed: 3.2, lineWidth: 1.8 });
|
|
74
|
+
setTimeout(() => this.spawnRipple(x, y, { speed: 2, lineWidth: 1.1 }), 80);
|
|
75
|
+
setTimeout(() => this.spawnRipple(x, y, { speed: 1.3, lineWidth: 0.7 }), 180);
|
|
76
|
+
}
|
|
77
|
+
onMouseLeave() {
|
|
78
|
+
this.hovered = false;
|
|
79
|
+
this.targetFill = 0;
|
|
80
|
+
this.fillSpeed = 0.048;
|
|
81
|
+
}
|
|
82
|
+
onMouseDown(cx, cy) {
|
|
83
|
+
for (let i = 0; i < 3; i++) {
|
|
30
84
|
setTimeout(() => {
|
|
31
|
-
this.
|
|
32
|
-
|
|
85
|
+
this.spawnRipple(cx, cy, {
|
|
86
|
+
speed: 4 - i * 0.8,
|
|
87
|
+
maxR: this.W * 0.5,
|
|
88
|
+
lineWidth: 2 - i * 0.4
|
|
89
|
+
});
|
|
90
|
+
}, i * 40);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/* ── Dibujo ── */
|
|
94
|
+
drawWave() {
|
|
95
|
+
const { ctx, W, H, A, f1, f2, s1, s2, t, wr, wg, wb, fill } = this;
|
|
96
|
+
if (fill <= 1e-3) return;
|
|
97
|
+
const baseY = H * (1 - fill);
|
|
98
|
+
ctx.beginPath();
|
|
99
|
+
ctx.moveTo(0, H);
|
|
100
|
+
ctx.lineTo(0, baseY);
|
|
101
|
+
for (let x = 0; x <= W; x++) {
|
|
102
|
+
const y = baseY + A * Math.sin(x * f1 + t * s1) + A * 0.45 * Math.sin(x * f2 - t * s2);
|
|
103
|
+
ctx.lineTo(x, y);
|
|
104
|
+
}
|
|
105
|
+
ctx.lineTo(W, H);
|
|
106
|
+
ctx.closePath();
|
|
107
|
+
const grad = ctx.createLinearGradient(0, baseY - A * 2, 0, H);
|
|
108
|
+
grad.addColorStop(0, `rgba(${wr},${wg},${wb},0.82)`);
|
|
109
|
+
grad.addColorStop(0.4, `rgba(${wr},${wg},${wb},0.92)`);
|
|
110
|
+
grad.addColorStop(1, `rgba(${wr},${wg},${wb},0.98)`);
|
|
111
|
+
ctx.fillStyle = grad;
|
|
112
|
+
ctx.fill();
|
|
113
|
+
if (this.shimmerX > -0.5 && this.shimmerX < 1.5) {
|
|
114
|
+
const sx = W * this.shimmerX;
|
|
115
|
+
const sg = ctx.createLinearGradient(sx - 40, 0, sx + 40, 0);
|
|
116
|
+
sg.addColorStop(0, "rgba(255,255,255,0)");
|
|
117
|
+
sg.addColorStop(0.5, "rgba(255,255,255,0.12)");
|
|
118
|
+
sg.addColorStop(1, "rgba(255,255,255,0)");
|
|
119
|
+
ctx.fillStyle = sg;
|
|
120
|
+
ctx.fillRect(0, Math.max(0, baseY - 4), W, H - Math.max(0, baseY - 4));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
drawRipples() {
|
|
124
|
+
const { ctx, rr, rg, rb } = this;
|
|
125
|
+
this.ripples = this.ripples.filter((r) => r.opacity > 0 || r.radius === 0);
|
|
126
|
+
for (const r of this.ripples) {
|
|
127
|
+
r.radius += r.speed;
|
|
128
|
+
r.opacity = Math.max(0, 1 - r.radius / r.maxRadius);
|
|
129
|
+
ctx.beginPath();
|
|
130
|
+
ctx.arc(r.x, r.y, r.radius, 0, Math.PI * 2);
|
|
131
|
+
ctx.strokeStyle = `rgba(${rr},${rg},${rb},${r.opacity * 0.9})`;
|
|
132
|
+
ctx.lineWidth = r.lineWidth;
|
|
133
|
+
ctx.stroke();
|
|
134
|
+
if (r.radius > 6) {
|
|
135
|
+
ctx.beginPath();
|
|
136
|
+
ctx.arc(r.x, r.y, r.radius * 0.65, 0, Math.PI * 2);
|
|
137
|
+
ctx.strokeStyle = `rgba(${rr},${rg},${rb},${r.opacity * 0.4})`;
|
|
138
|
+
ctx.lineWidth = r.lineWidth * 0.5;
|
|
139
|
+
ctx.stroke();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
this.ripples = this.ripples.filter((r) => r.opacity > 0);
|
|
143
|
+
}
|
|
144
|
+
/* ── Loop principal ── */
|
|
145
|
+
loop() {
|
|
146
|
+
const tick = () => {
|
|
147
|
+
this.raf = requestAnimationFrame(tick);
|
|
148
|
+
const { ctx, W, H } = this;
|
|
149
|
+
this.t += 0.04;
|
|
150
|
+
const diff = this.targetFill - this.fill;
|
|
151
|
+
this.fill += diff * this.fillSpeed * 2.8;
|
|
152
|
+
if (Math.abs(diff) < 5e-4) this.fill = this.targetFill;
|
|
153
|
+
if (this.hovered && this.shimmerX < 1.6) {
|
|
154
|
+
this.shimmerX += 0.012;
|
|
155
|
+
}
|
|
156
|
+
if (this.fill <= 1e-3 && this.ripples.length === 0) return;
|
|
157
|
+
ctx.clearRect(0, 0, W, H);
|
|
158
|
+
this.drawWave();
|
|
159
|
+
this.drawRipples();
|
|
33
160
|
};
|
|
161
|
+
this.raf = requestAnimationFrame(tick);
|
|
162
|
+
}
|
|
163
|
+
/* ── Cleanup ── */
|
|
164
|
+
destroy() {
|
|
165
|
+
cancelAnimationFrame(this.raf);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let LibButtonLiquid = class extends LitElement {
|
|
169
|
+
constructor() {
|
|
170
|
+
super(...arguments);
|
|
171
|
+
this.variant = "ink";
|
|
172
|
+
this.size = "md";
|
|
173
|
+
this.disabled = false;
|
|
174
|
+
this.loading = false;
|
|
175
|
+
this.dark = false;
|
|
176
|
+
this.block = false;
|
|
177
|
+
this._physics = null;
|
|
178
|
+
this._canvas = null;
|
|
179
|
+
this._ro = null;
|
|
34
180
|
}
|
|
35
|
-
|
|
181
|
+
/* ── Lifecycle ── */
|
|
36
182
|
firstUpdated() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
this.parentElement.addEventListener("mousedown", this.createRipple);
|
|
45
|
-
} else {
|
|
46
|
-
console.error("LibRipple: No se encontró parentElement. ¿Está el componente dentro de un contenedor?");
|
|
183
|
+
this._initCanvas();
|
|
184
|
+
}
|
|
185
|
+
updated(changed) {
|
|
186
|
+
if (changed.has("variant")) {
|
|
187
|
+
this._destroyCanvas();
|
|
188
|
+
this._initCanvas();
|
|
47
189
|
}
|
|
48
190
|
}
|
|
49
191
|
disconnectedCallback() {
|
|
50
192
|
var _a;
|
|
51
|
-
(_a = this.parentElement) == null ? void 0 : _a.removeEventListener("mousedown", this.createRipple);
|
|
52
193
|
super.disconnectedCallback();
|
|
194
|
+
this._destroyCanvas();
|
|
195
|
+
(_a = this._ro) == null ? void 0 : _a.disconnect();
|
|
196
|
+
}
|
|
197
|
+
/* ── Canvas setup ── */
|
|
198
|
+
_initCanvas() {
|
|
199
|
+
if (!this._btn) return;
|
|
200
|
+
const canvas = document.createElement("canvas");
|
|
201
|
+
this._canvas = canvas;
|
|
202
|
+
this._btn.insertBefore(canvas, this._btn.firstChild);
|
|
203
|
+
const palette = LIQUID_PALETTES[this.variant];
|
|
204
|
+
this._physics = new WaterPhysics(this._btn, canvas, palette.water, palette.ripple);
|
|
205
|
+
this._ro = new ResizeObserver(() => {
|
|
206
|
+
var _a;
|
|
207
|
+
return (_a = this._physics) == null ? void 0 : _a.resize();
|
|
208
|
+
});
|
|
209
|
+
this._ro.observe(this._btn);
|
|
210
|
+
}
|
|
211
|
+
_destroyCanvas() {
|
|
212
|
+
var _a, _b, _c;
|
|
213
|
+
(_a = this._physics) == null ? void 0 : _a.destroy();
|
|
214
|
+
this._physics = null;
|
|
215
|
+
(_b = this._canvas) == null ? void 0 : _b.remove();
|
|
216
|
+
this._canvas = null;
|
|
217
|
+
(_c = this._ro) == null ? void 0 : _c.disconnect();
|
|
218
|
+
this._ro = null;
|
|
219
|
+
}
|
|
220
|
+
/* ── Eventos del canvas — llamados desde el template ── */
|
|
221
|
+
_onMouseEnter(e) {
|
|
222
|
+
var _a;
|
|
223
|
+
if (this.disabled || this.loading) return;
|
|
224
|
+
const rect = this._btn.getBoundingClientRect();
|
|
225
|
+
(_a = this._physics) == null ? void 0 : _a.onMouseEnter(e.clientX - rect.left, e.clientY - rect.top);
|
|
226
|
+
}
|
|
227
|
+
_onMouseLeave() {
|
|
228
|
+
var _a;
|
|
229
|
+
(_a = this._physics) == null ? void 0 : _a.onMouseLeave();
|
|
230
|
+
}
|
|
231
|
+
_onMouseDown(e) {
|
|
232
|
+
var _a;
|
|
233
|
+
if (this.disabled || this.loading) return;
|
|
234
|
+
const rect = this._btn.getBoundingClientRect();
|
|
235
|
+
(_a = this._physics) == null ? void 0 : _a.onMouseDown(e.clientX - rect.left, e.clientY - rect.top);
|
|
236
|
+
this.dispatchEvent(new CustomEvent("ui-lib-click", {
|
|
237
|
+
detail: { originalEvent: e },
|
|
238
|
+
bubbles: true,
|
|
239
|
+
composed: true
|
|
240
|
+
}));
|
|
53
241
|
}
|
|
242
|
+
/* ── Render ── */
|
|
54
243
|
render() {
|
|
55
|
-
return
|
|
244
|
+
return buttonLiquidTemplate(this);
|
|
56
245
|
}
|
|
57
246
|
};
|
|
58
|
-
|
|
247
|
+
LibButtonLiquid.styles = [
|
|
248
|
+
css`${unsafeCSS(sharedTokens)}`,
|
|
249
|
+
css`${unsafeCSS(liquidCss)}`
|
|
250
|
+
];
|
|
251
|
+
__decorateClass([
|
|
252
|
+
property({ type: String, reflect: true })
|
|
253
|
+
], LibButtonLiquid.prototype, "variant", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property({ type: String, reflect: true })
|
|
256
|
+
], LibButtonLiquid.prototype, "size", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property({ type: Boolean, reflect: true })
|
|
259
|
+
], LibButtonLiquid.prototype, "disabled", 2);
|
|
260
|
+
__decorateClass([
|
|
261
|
+
property({ type: Boolean, reflect: true })
|
|
262
|
+
], LibButtonLiquid.prototype, "loading", 2);
|
|
263
|
+
__decorateClass([
|
|
264
|
+
property({ type: Boolean, reflect: true })
|
|
265
|
+
], LibButtonLiquid.prototype, "dark", 2);
|
|
266
|
+
__decorateClass([
|
|
267
|
+
property({ type: Boolean, reflect: true })
|
|
268
|
+
], LibButtonLiquid.prototype, "block", 2);
|
|
59
269
|
__decorateClass([
|
|
60
|
-
|
|
61
|
-
],
|
|
62
|
-
|
|
63
|
-
customElement("lib-
|
|
64
|
-
],
|
|
270
|
+
query(".btn")
|
|
271
|
+
], LibButtonLiquid.prototype, "_btn", 2);
|
|
272
|
+
LibButtonLiquid = __decorateClass([
|
|
273
|
+
customElement("lib-button-liquid")
|
|
274
|
+
], LibButtonLiquid);
|
|
65
275
|
export {
|
|
66
|
-
|
|
276
|
+
LibButtonLiquid
|
|
67
277
|
};
|
|
68
278
|
//# sourceMappingURL=index29.js.map
|
package/dist/index29.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index29.js","sources":["../src/components/atoms/ripple/lib-ripple.component.ts"],"sourcesContent":["import { LitElement, TemplateResult, css, unsafeCSS } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport { rippleTemplate } from './lib-ripple.html';\nimport styles from './lib-ripple.css?inline';\n\nexport interface RippleEffect {\n id: number;\n x: number;\n y: number;\n size: number;\n}\n\n@customElement('lib-ripple')\nexport class LibRipple extends LitElement {\n // Importante: usamos unsafeCSS para el string del CSS inyectado\n static override styles = [css`${unsafeCSS(styles)}`];\n\n @state() private ripples: RippleEffect[] = [];\n private count: number = 0;\n\n // 1. Aseguramos la conexión al padre cuando el componente entra al DOM\n override firstUpdated(): void {\n console.log('LibRipple: ¡Estoy vivo y montado!');\n \n if (this.parentElement) {\n console.log('LibRipple: Padre detectado ->', this.parentElement.tagName);\n \n // Forzamos que el padre sea relativo si no lo es\n const parentStyle = window.getComputedStyle(this.parentElement);\n if (parentStyle.position === 'static') {\n this.parentElement.style.position = 'relative';\n }\n\n this.parentElement.addEventListener('mousedown', this.createRipple);\n } else {\n console.error('LibRipple: No se encontró parentElement. ¿Está el componente dentro de un contenedor?');\n }\n }\n\n override disconnectedCallback(): void {\n this.parentElement?.removeEventListener('mousedown', this.createRipple);\n super.disconnectedCallback();\n }\n\n private createRipple = (event: MouseEvent): void => {\n console.log('LibRipple: Click detectado en coordenadas:', event.clientX, event.clientY);\n \n if (!this.parentElement) return;\n\n const rect: DOMRect = this.parentElement.getBoundingClientRect();\n \n // Calculamos el tamaño para cubrir todo el contenedor (Pitágoras pro)\n const size: number = Math.sqrt(rect.width ** 2 + rect.height ** 2) * 2;\n \n const x: number = event.clientX - rect.left - size / 2;\n const y: number = event.clientY - rect.top - size / 2;\n\n const id: number = this.count++;\n const newRipple: RippleEffect = { id, x, y, size };\n \n this.ripples = [...this.ripples, newRipple];\n\n // Limpiamos después de la animación (600ms según tus tokens)\n setTimeout(() => {\n this.ripples = this.ripples.fil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AAK;AAC1D,UAAM,qBAAA;AAAA,EACR;AAAA,EA0BmB,SAAyB;AAC1C,WAAO,eAAe,KAAK,OAAO;AAAA,EACpC;AACF;AA1Da,UAEK,SAAS,CAAC,MAAM,UAAU,MAAM,CAAC,EAAE;AAElC,gBAAA;AAAA,EAAhB,MAAA;AAAM,GAJI,UAIM,WAAA,WAAA,CAAA;AAJN,YAAN,gBAAA;AAAA,EADN,cAAc,YAAY;AAAA,GACd,SAAA;"}
|
|
1
|
+
{"version":3,"file":"index29.js","sources":["../src/components/atoms/liquid-button/lib-liquid-button.component.ts"],"sourcesContent":["import { LitElement, css, unsafeCSS, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { buttonLiquidTemplate } from './lib-liquid-button.html';\nimport liquidCss from './lib-liquid-button.css?inline';\nimport sharedTokens from '../../../styles/shared/tokens.css?inline';\nimport { LIQUID_PALETTES } from './lib-liquid-button.types';\nimport type { LiquidVariant, LiquidSize } from './lib-liquid-button.types';\n\n/* ============================================================\n WaterPhysics — clase interna de física de canvas\n Portada desde el SG-41 (vanilla JS → TypeScript puro)\n ============================================================ */\nclass WaterPhysics {\n private btn: HTMLElement;\n private canvas: HTMLCanvasElement;\n private ctx: CanvasRenderingContext2D;\n\n /* Colores */\n private wr: number; private wg: number; private wb: number;\n private rr: number; private rg: number; private rb: number;\n\n /* Estado */\n private fill = 0;\n private targetFill = 0;\n private fillSpeed = 0.032;\n private shimmerX = -1;\n private t = 0;\n private hovered = false;\n private raf = 0;\n\n /* Física de onda */\n private readonly A = 3.5;\n private readonly f1 = 0.038;\n private readonly f2 = 0.063;\n private readonly s1 = 1.8;\n private readonly s2 = 1.2;\n\n private W = 0;\n private H = 0;\n\n private ripples: Array<{\n x: number; y: number;\n radius: number; maxRadius: number;\n speed: number; lineWidth: number;\n opacity: number;\n }> = [];\n\n constructor(\n btn: HTMLElement,\n canvas: HTMLCanvasElement,\n water: [number, number, number],\n ripple: [number, number, number],\n ) {\n this.btn = btn;\n this.canvas = canvas;\n this.ctx = canvas.getContext('2d')!;\n [this.wr, this.wg, this.wb] = water;\n [this.rr, this.rg, this.rb] = ripple;\n\n this.resize();\n this.loop();\n }\n\n /* ── Dimensiones con DPR ── */\n resize(): void {\n const r = this.btn.getBoundingClientRect();\n const dpr = window.devicePixelRatio || 1;\n this.W = r.width;\n this.H = r.height;\n this.canvas.width = this.W * dpr;\n this.canvas.height = this.H * dpr;\n this.canvas.style.width = `${this.W}px`;\n this.canvas.style.height = `${this.H}px`;\n this.ctx.scale(dpr, dpr);\n }\n\n /* ── Spawn de ripple ── */\n spawnRipple(\n x: number, y: number,\n { speed = 2.2, maxR, lineWidth = 1.2 }:\n { speed?: number; maxR?: number; lineWidth?: number } = {},\n ): void {\n const diag = Math.sqrt(this.W ** 2 + this.H ** 2);\n this.ripples.push({\n x, y,\n radius: 0,\n maxRadius: maxR ?? diag * 0.72,\n speed,\n lineWidth,\n opacity: 0,\n });\n }\n\n /* ── Eventos públicos — llamados por el componente Lit ── */\n onMouseEnter(x: number, y: number): void {\n this.hovered = true;\n this.targetFill = 1;\n this.fillSpeed = 0.028;\n this.shimmerX = -0.3;\n\n this.spawnRipple(x, y, { speed: 3.2, lineWidth: 1.8 });\n setTimeout((): void => this.spawnRipple(x, y, { speed: 2.0, lineWidth: 1.1 }), 80);\n setTimeout((): void => this.spawnRipple(x, y, { speed: 1.3, lineWidth: 0.7 }), 180);\n }\n\n onMouseLeave(): void {\n this.hovered = false;\n this.targetFill = 0;\n this.fillSpeed = 0.048;\n }\n\n onMouseDown(cx: number, cy: number): void {\n for (let i = 0; i < 3; i++) {\n setTimeout((): void => {\n this.spawnRipple(cx, cy, {\n speed: 4 - i * 0.8,\n maxR: this.W * 0.5,\n lineWidth: 2 - i * 0.4,\n });\n }, i * 40);\n }\n }\n\n /* ── Dibujo ── */\n private drawWave(): void {\n const { ctx, W, H, A, f1, f2, s1, s2, t, wr, wg, wb, fill } = this;\n if (fill <= 0.001) return;\n\n const baseY = H * (1 - fill);\n\n /* Cuerpo sinusoidal */\n ctx.beginPath();\n ctx.moveTo(0, H);\n ctx.lineTo(0, baseY);\n for (let x = 0; x <= W; x++) {\n const y = baseY\n + A * Math.sin(x * f1 + t * s1)\n + A * 0.45 * Math.sin(x * f2 - t * s2);\n ctx.lineTo(x, y);\n }\n ctx.lineTo(W, H);\n ctx.closePath();\n\n /* Gradiente vertical */\n const grad = ctx.createLinearGradient(0, baseY - A * 2, 0, H);\n grad.addColorStop(0, `rgba(${wr},${wg},${wb},0.82)`);\n grad.addColorStop(0.4, `rgba(${wr},${wg},${wb},0.92)`);\n grad.addColorStop(1, `rgba(${wr},${wg},${wb},0.98)`);\n ctx.fillStyle = grad;\n ctx.fill();\n\n /* Shimmer diagonal */\n if (this.shimmerX > -0.5 && this.shimmerX < 1.5) {\n const sx = W * this.shimmerX;\n const sg = ctx.createLinearGradient(sx - 40, 0, sx + 40, 0);\n sg.addColorStop(0, 'rgba(255,255,255,0)');\n sg.addColorStop(0.5, 'rgba(255,255,255,0.12)');\n sg.addColorStop(1, 'rgba(255,255,255,0)');\n ctx.fillStyle = sg;\n ctx.fillRect(0, Math.max(0, baseY - 4), W, H - Math.max(0, baseY - 4));\n }\n }\n\n private drawRipples(): void {\n const { ctx, rr, rg, rb } = this;\n this.ripples = this.ripples.filter(r => r.opacity > 0 || r.radius === 0);\n\n for (const r of this.ripples) {\n r.radius += r.speed;\n r.opacity = Math.max(0, 1 - r.radius / r.maxRadius);\n\n /* Anillo principal */\n ctx.beginPath();\n ctx.arc(r.x, r.y, r.radius, 0, Math.PI * 2);\n ctx.strokeStyle = `rgba(${rr},${rg},${rb},${r.opacity * 0.9})`;\n ctx.lineWidth = r.lineWidth;\n ctx.stroke();\n\n /* Segundo anillo interior más fino */\n if (r.radius > 6) {\n ctx.beginPath();\n ctx.arc(r.x, r.y, r.radius * 0.65, 0, Math.PI * 2);\n ctx.strokeStyle = `rgba(${rr},${rg},${rb},${r.opacity * 0.4})`;\n ctx.lineWidth = r.lineWidth * 0.5;\n ctx.stroke();\n }\n }\n\n /* Limpiar ripples agotados */\n this.ripples = this.ripples.filter(r => r.opacity > 0);\n }\n\n /* ── Loop principal ── */\n private loop(): void {\n const tick = (): void => {\n this.raf = requestAnimationFrame(tick);\n const { ctx, W, H } = this;\n this.t += 0.04;\n\n /* Lerp fill */\n const diff = this.targetFill - this.fill;\n this.fill += diff * this.fillSpeed * 2.8;\n if (Math.abs(diff) < 0.0005) this.fill = this.targetFill;\n\n /* Shimmer avanza */\n if (this.hovered && this.shimmerX < 1.6) {\n this.shimmerX += 0.012;\n }\n\n /* Skip si todo en reposo */\n if (this.fill <= 0.001 && this.ripples.length === 0) return;\n\n ctx.clearRect(0, 0, W, H);\n this.drawWave();\n this.drawRipples();\n };\n this.raf = requestAnimationFrame(tick);\n }\n\n /* ── Cleanup ── */\n destroy(): void {\n cancelAnimationFrame(this.raf);\n }\n}\n\n\n/* ============================================================\n LIB-BUTTON-LIQUID — Web Component\n ============================================================ */\n\n/**\n * Botón con física de agua en canvas.\n *\n * @prop variant — 'ink' | 'washi' | 'kaki' | 'celadon' | 'ghost' | 'danger'\n * @prop size — 'sm' | 'md' | 'lg'\n * @prop disabled — bloquea interacción y detiene el canvas\n * @prop loading — muestra spinner, bloquea interacción\n * @prop dark — ajusta colores en surface oscura\n * @prop block — ancho 100%\n *\n * Slots: default · prefix · suffix\n * @fires ui-lib-click — {detail: { originalEvent: MouseEvent }}\n */\n@customElement('lib-button-liquid')\nexport class LibButtonLiquid extends LitElement {\n static override styles = [\n css`${unsafeCSS(sharedTokens)}`,\n css`${unsafeCSS(liquidCss)}`,\n ];\n\n @property({ type: String, reflect: true })\n variant: LiquidVariant = 'ink';\n\n @property({ type: String, reflect: true })\n size: LiquidSize = 'md';\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n @property({ type: Boolean, reflect: true })\n dark = false;\n\n @property({ type: Boolean, reflect: true })\n block = false;\n\n @query('.btn')\n declare private _btn: HTMLButtonElement;\n\n private _physics: WaterPhysics | null = null;\n private _canvas: HTMLCanvasElement | null = null;\n private _ro: ResizeObserver | null = null;\n\n /* ── Lifecycle ── */\n\n override firstUpdated(): void {\n this._initCanvas();\n }\n\n override updated(changed: Map<string, unknown>): void {\n /* Si cambia la variante, reconstruir physics con nueva paleta */\n if (changed.has('variant')) {\n this._destroyCanvas();\n this._initCanvas();\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._destroyCanvas();\n this._ro?.disconnect();\n }\n\n /* ── Canvas setup ── */\n\n private _initCanvas(): void {\n if (!this._btn) return;\n\n /* Crear canvas y añadirlo como primer hijo del botón (bajo .btn-inner) */\n const canvas = document.createElement('canvas');\n this._canvas = canvas;\n this._btn.insertBefore(canvas, this._btn.firstChild);\n\n const palette = LIQUID_PALETTES[this.variant];\n this._physics = new WaterPhysics(this._btn, canvas, palette.water, palette.ripple);\n\n /* ResizeObserver para adaptar canvas al tamaño real del botón */\n this._ro = new ResizeObserver((): void => this._physics?.resize());\n this._ro.observe(this._btn);\n }\n\n private _destroyCanvas(): void {\n this._physics?.destroy();\n this._physics = null;\n this._canvas?.remove();\n this._canvas = null;\n this._ro?.disconnect();\n this._ro = null;\n }\n\n /* ── Eventos del canvas — llamados desde el template ── */\n\n _onMouseEnter(e: MouseEvent): void {\n if (this.disabled || this.loading) return;\n const rect = this._btn.getBoundingClientRect();\n this._physics?.onMouseEnter(e.clientX - rect.left, e.clientY - rect.top);\n }\n\n _onMouseLeave(): void {\n this._physics?.onMouseLeave();\n }\n\n _onMouseDown(e: MouseEvent): void {\n if (this.disabled || this.loading) return;\n const rect = this._btn.getBoundingClientRect();\n this._physics?.onMouseDown(e.clientX - rect.left, e.clientY - rect.top);\n\n this.dispatchEvent(new CustomEvent('ui-lib-click', {\n detail: { originalEvent: e },\n bubbles: true,\n composed: true,\n }));\n }\n\n /* ── Render ── */\n protected override render(): TemplateResult {\n return buttonLiquidTem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/index290.js
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
const checkSvg = html`
|
|
3
|
+
<svg class="checkbox__check" viewBox="0 0 10 10" aria-hidden="true">
|
|
4
|
+
<polyline points="1.5,5 4,7.5 8.5,2"/>
|
|
5
|
+
</svg>
|
|
6
|
+
`;
|
|
7
|
+
const dashEl = html`<span class="checkbox__dash" aria-hidden="true"></span>`;
|
|
8
|
+
function checkboxTemplate(props) {
|
|
9
|
+
return html`
|
|
10
|
+
<label class="checkbox">
|
|
11
|
+
|
|
12
|
+
<input
|
|
13
|
+
class="checkbox__input"
|
|
14
|
+
type="checkbox"
|
|
15
|
+
.checked="${props.checked}"
|
|
16
|
+
.indeterminate="${props.indeterminate}"
|
|
17
|
+
?disabled="${props.disabled}"
|
|
18
|
+
value="${props.value}"
|
|
19
|
+
@change="${props.onChange}"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<span class="checkbox__box">
|
|
23
|
+
${props.indeterminate ? dashEl : checkSvg}
|
|
24
|
+
</span>
|
|
25
|
+
|
|
26
|
+
${props.label || props.sublabel ? html`
|
|
27
|
+
<span class="checkbox__label">
|
|
28
|
+
${props.label ? html`<span class="checkbox__label-text">${props.label}</span>` : nothing}
|
|
29
|
+
${props.sublabel ? html`<span class="checkbox__label-sub">${props.sublabel}</span>` : nothing}
|
|
30
|
+
</span>
|
|
31
|
+
` : html`<slot></slot>`}
|
|
32
|
+
|
|
33
|
+
</label>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
2
36
|
export {
|
|
3
|
-
|
|
37
|
+
checkboxTemplate
|
|
4
38
|
};
|
|
5
39
|
//# sourceMappingURL=index290.js.map
|
package/dist/index290.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index290.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index290.js","sources":["../src/components/atoms/checkbox/lib-checkbox.html.ts"],"sourcesContent":["import { html, nothing, TemplateResult } from 'lit';\n\nexport type LibCheckboxSize = 'sm' | 'md' | 'lg';\nexport type LibCheckboxVariant = 'default' | 'kaki' | 'error';\n\nexport interface CheckboxTemplateProps {\n checked: boolean;\n disabled: boolean;\n indeterminate: boolean;\n label: string;\n sublabel: string;\n value: string;\n size: LibCheckboxSize;\n variant: LibCheckboxVariant;\n onChange: (e: Event) => void;\n}\n\n/** SVG check — polyline del styleguide, animado con ease-bounce */\nconst checkSvg = html`\n <svg class=\"checkbox__check\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <polyline points=\"1.5,5 4,7.5 8.5,2\"/>\n </svg>\n`;\n\n/** SVG dash — estado indeterminate */\nconst dashEl = html`<span class=\"checkbox__dash\" aria-hidden=\"true\"></span>`;\n\n/**\n * Plantilla para lib-checkbox.\n *\n * Estructura:\n * label.checkbox\n * input[type=checkbox] (capa de interaccion, invisible)\n * span.checkbox__box (visual: box + check/dash)\n * span.checkbox__label (label-text + sublabel opcional)\n */\nexport function checkboxTemplate(props: CheckboxTemplateProps): TemplateResult {\n return html`\n <label class=\"checkbox\">\n\n <input\n class=\"checkbox__input\"\n type=\"checkbox\"\n .checked=\"${props.checked}\"\n .indeterminate=\"${props.indeterminate}\"\n ?disabled=\"${props.disabled}\"\n value=\"${props.value}\"\n @change=\"${props.onChange}\"\n />\n\n <span class=\"checkbox__box\">\n ${props.indeterminate ? dashEl : checkSvg}\n </span>\n\n ${props.label || props.sublabel\n ? html`\n <span class=\"checkbox__label\">\n ${props.label\n ? html`<span class=\"checkbox__label-text\">${props.label}</span>`\n : nothing}\n ${props.sublabel\n ? html`<span class=\"checkbox__label-sub\">${props.sublabel}</span>`\n : nothing}\n </span>\n `\n : html`<slot></slot>`}\n\n </label>\n `;\n}"],"names":[],"mappings":";AAkBA,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAOjB,MAAM,SAAS;AAWR,SAAS,iBAAiB,OAA8C;AAC7E,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMW,MAAM,OAAO;AAAA,0BACP,MAAM,aAAa;AAAA,qBACxB,MAAM,QAAQ;AAAA,iBAClB,MAAM,KAAK;AAAA,mBACT,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA,UAIvB,MAAM,gBAAgB,SAAS,QAAQ;AAAA;AAAA;AAAA,QAGzC,MAAM,SAAS,MAAM,WACnB;AAAA;AAAA,gBAEM,MAAM,QACJ,0CAA0C,MAAM,KAAK,YACrD,OAAO;AAAA,gBACT,MAAM,WACJ,yCAAyC,MAAM,QAAQ,YACvD,OAAO;AAAA;AAAA,cAGf,mBAAmB;AAAA;AAAA;AAAA;AAI7B;"}
|
package/dist/index291.js
CHANGED
|
@@ -1,60 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
const removeSvg = html`
|
|
3
|
-
<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true">
|
|
4
|
-
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/>
|
|
5
|
-
</svg>`;
|
|
6
|
-
function staticChip() {
|
|
7
|
-
return html`
|
|
8
|
-
<span class="chip" part="chip" role="note" tabindex="-1">
|
|
9
|
-
<slot name="icon"></slot>
|
|
10
|
-
<slot></slot>
|
|
11
|
-
</span>`;
|
|
12
|
-
}
|
|
13
|
-
function toggleChip(ctx) {
|
|
14
|
-
return html`
|
|
15
|
-
<button
|
|
16
|
-
class="chip-toggle"
|
|
17
|
-
part="chip"
|
|
18
|
-
role="checkbox"
|
|
19
|
-
aria-checked="${ctx.selected}"
|
|
20
|
-
aria-label="${ctx.ariaLabel}"
|
|
21
|
-
@click="${() => ctx._handleToggle()}"
|
|
22
|
-
@keydown="${(e) => {
|
|
23
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
24
|
-
e.preventDefault();
|
|
25
|
-
ctx._handleToggle();
|
|
26
|
-
}
|
|
27
|
-
}}"
|
|
28
|
-
>
|
|
29
|
-
<slot name="icon"></slot>
|
|
30
|
-
<slot></slot>
|
|
31
|
-
</button>`;
|
|
32
|
-
}
|
|
33
|
-
function inputChip(ctx) {
|
|
34
|
-
return html`
|
|
35
|
-
<span class="chip-input" part="chip">
|
|
36
|
-
<slot name="avatar"></slot>
|
|
37
|
-
<slot name="icon"></slot>
|
|
38
|
-
<slot></slot>
|
|
39
|
-
<button
|
|
40
|
-
class="chip-remove"
|
|
41
|
-
part="remove"
|
|
42
|
-
type="button"
|
|
43
|
-
aria-label="Eliminar ${ctx.ariaLabel || ""}"
|
|
44
|
-
@click="${(e) => ctx._handleRemove(e)}"
|
|
45
|
-
>
|
|
46
|
-
${removeSvg}
|
|
47
|
-
</button>
|
|
48
|
-
</span>`;
|
|
49
|
-
}
|
|
50
|
-
function chipTemplate(ctx) {
|
|
51
|
-
if (ctx.kind === "toggle") return toggleChip(ctx);
|
|
52
|
-
if (ctx.kind === "input") return inputChip(ctx);
|
|
53
|
-
return staticChip(
|
|
54
|
-
/*ctx*/
|
|
55
|
-
);
|
|
56
|
-
}
|
|
1
|
+
const checkboxCss = '@layer tokens,reset,components;@layer reset{:host{display:inline-block}*,*:before,*:after{box-sizing:border-box}}@layer components{.checkbox{display:inline-flex;align-items:flex-start;gap:var(--lib-space-sm);cursor:pointer;-webkit-user-select:none;user-select:none}:host([disabled]) .checkbox{cursor:not-allowed;opacity:.4;pointer-events:none}.checkbox__input{-webkit-appearance:none;-moz-appearance:none;appearance:none;position:absolute;width:0;height:0;margin:0;opacity:0;pointer-events:none}.checkbox__box{width:18px;height:18px;flex-shrink:0;margin-top:2px;border:1px solid var(--border-default);background:var(--bg-elevated);border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;transition:background var(--duration-fast) var(--ease-default),border-color var(--duration-fast) var(--ease-default),box-shadow var(--duration-base) var(--ease-default)}.checkbox:hover .checkbox__box{border-color:var(--border-strong)}.checkbox__input:focus-visible~.checkbox__box,.checkbox:focus-within .checkbox__box{box-shadow:0 0 0 3px var(--color-ink-20);border-color:var(--color-washi-700)}:host([checked]) .checkbox__box{background:var(--color-washi-900);border-color:var(--color-washi-900)}:host([indeterminate]) .checkbox__box{background:var(--color-washi-900);border-color:var(--color-washi-900)}.checkbox__check{width:10px;height:10px;stroke:#fff;stroke-width:2.5;fill:none;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.6);transition:opacity var(--duration-fast) var(--ease-out),transform var(--duration-base) var(--ease-bounce)}:host([checked]) .checkbox__check{opacity:1;transform:scale(1)}.checkbox__dash{width:8px;height:2px;background:#fff;border-radius:1px;opacity:0;transform:scaleX(.4);transition:opacity var(--duration-fast) var(--ease-out),transform var(--duration-base) var(--ease-bounce)}:host([indeterminate]) .checkbox__dash{opacity:1;transform:scaleX(1)}.checkbox__label{display:flex;flex-direction:column;gap:var(--lib-space-xs)}.checkbox__label-text{font-family:var(--lib-font-body);font-size:var(--text-base);color:var(--text-primary);line-height:var(--leading-snug);transition:color var(--duration-fast)}.checkbox__label-sub{font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-wide);color:var(--text-muted);line-height:var(--leading-snug)}:host([size="sm"]) .checkbox__box{width:14px;height:14px}:host([size="sm"]) .checkbox__check{width:8px;height:8px;stroke-width:2.5}:host([size="sm"]) .checkbox__dash{width:6px;height:1.5px}:host([size="sm"]) .checkbox__label-text{font-size:var(--text-sm)}:host([size="lg"]) .checkbox__box{width:22px;height:22px}:host([size="lg"]) .checkbox__check{width:13px;height:13px}:host([size="lg"]) .checkbox__dash{width:10px;height:2.5px}:host([size="lg"]) .checkbox__label-text{font-size:var(--text-md)}:host([variant="kaki"][checked]) .checkbox__box,:host([variant="kaki"][indeterminate]) .checkbox__box{background:var(--color-kaki-500);border-color:var(--color-kaki-500)}:host([variant="kaki"]) .checkbox:hover .checkbox__box{border-color:var(--color-kaki-400)}:host([variant="kaki"]) .checkbox:focus-within .checkbox__box{box-shadow:0 0 0 3px #6d4d3e1f;border-color:var(--color-kaki-500)}:host([variant="error"]) .checkbox__box{border-color:var(--color-error)}:host([variant="error"]) .checkbox:hover .checkbox__box{border-color:var(--color-error)}:host([variant="error"]) .checkbox__label-text{color:var(--color-error)}@media(prefers-reduced-motion:reduce){.checkbox__box,.checkbox__check,.checkbox__dash{transition:none}}}';
|
|
57
2
|
export {
|
|
58
|
-
|
|
3
|
+
checkboxCss as default
|
|
59
4
|
};
|
|
60
5
|
//# sourceMappingURL=index291.js.map
|
package/dist/index291.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index291.js","sources":[
|
|
1
|
+
{"version":3,"file":"index291.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index292.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
const ICON_SIZE = {
|
|
3
|
+
sm: "xs",
|
|
4
|
+
md: "sm",
|
|
5
|
+
lg: "sm",
|
|
6
|
+
xl: "md"
|
|
7
|
+
};
|
|
8
|
+
function closeButtonTemplate(props) {
|
|
9
|
+
return html`
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
class="close-btn"
|
|
13
|
+
aria-label="${props.ariaLabel}"
|
|
14
|
+
?disabled="${props.disabled}"
|
|
15
|
+
@click="${props.onClick}"
|
|
16
|
+
>
|
|
17
|
+
<lib-icon
|
|
18
|
+
name="${props.icon}"
|
|
19
|
+
size="${ICON_SIZE[props.size]}"
|
|
20
|
+
></lib-icon>
|
|
21
|
+
</button>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
2
24
|
export {
|
|
3
|
-
|
|
25
|
+
closeButtonTemplate
|
|
4
26
|
};
|
|
5
27
|
//# sourceMappingURL=index292.js.map
|
package/dist/index292.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index292.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index292.js","sources":["../src/components/atoms/close-button/lib-close-button.html.ts"],"sourcesContent":["import { html, TemplateResult } from 'lit';\n\nexport type LibCloseVariant =\n | 'ghost'\n | 'subtle'\n | 'outlined'\n | 'filled'\n | 'filled-round'\n | 'danger'\n | 'on-dark';\n\nexport type LibCloseSize = 'sm' | 'md' | 'lg' | 'xl';\nexport type LibCloseIcon = 'x' | 'x-circle' | 'x-square';\n\n/** Maps component size → lib-icon size prop */\nconst ICON_SIZE: Record<LibCloseSize, string> = {\n sm: 'xs',\n md: 'sm',\n lg: 'sm',\n xl: 'md',\n};\n\nexport interface CloseButtonTemplateProps {\n variant: LibCloseVariant;\n size: LibCloseSize;\n icon: LibCloseIcon;\n disabled: boolean;\n ariaLabel: string;\n onClick: (e: Event) => void;\n}\n\n/**\n * Plantilla para lib-close-button.\n *\n * Renderiza un <button> con lib-icon interno.\n * La variante y el tamaño se aplican via :host() selectors en CSS.\n */\nexport function closeButtonTemplate(props: CloseButtonTemplateProps): TemplateResult {\n return html`\n <button\n type=\"button\"\n class=\"close-btn\"\n aria-label=\"${props.ariaLabel}\"\n ?disabled=\"${props.disabled}\"\n @click=\"${props.onClick}\"\n >\n <lib-icon\n name=\"${props.icon}\"\n size=\"${ICON_SIZE[props.size]}\"\n ></lib-icon>\n </button>\n `;\n}"],"names":[],"mappings":";AAeA,MAAM,YAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAiBO,SAAS,oBAAoB,OAAiD;AACnF,SAAO;AAAA;AAAA;AAAA;AAAA,oBAIW,MAAM,SAAS;AAAA,mBAChB,MAAM,QAAQ;AAAA,gBACjB,MAAM,OAAO;AAAA;AAAA;AAAA,gBAGb,MAAM,IAAI;AAAA,gBACV,UAAU,MAAM,IAAI,CAAC;AAAA;AAAA;AAAA;AAIrC;"}
|
package/dist/index293.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const closeButtonCss = '@layer tokens,reset,components;@layer reset{:host{display:inline-flex;flex-shrink:0}*,*:before,*:after{box-sizing:border-box}}@layer components{.close-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;padding:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;color:var(--text-muted);line-height:1;outline:none;transition:color var(--duration-fast) var(--ease-default),background var(--duration-base) var(--ease-default),border-color var(--duration-base) var(--ease-default),transform var(--duration-base) var(--ease-bounce),opacity var(--duration-base)}.close-btn:disabled{opacity:.35;pointer-events:none;cursor:not-allowed}.close-btn:focus-visible{box-shadow:0 0 0 3px var(--color-ink-20)}:host([size="sm"]) .close-btn{width:24px;height:24px}:host([size="md"]) .close-btn{width:32px;height:32px}:host([size="lg"]) .close-btn{width:40px;height:40px}:host([size="xl"]) .close-btn{width:48px;height:48px}:host([variant="ghost"]) .close-btn{color:var(--text-muted);border-radius:var(--radius-sm)}:host([variant="ghost"]) .close-btn:hover{color:var(--text-primary);background:var(--color-washi-200)}:host([variant="ghost"]) .close-btn:active{transform:scale(.88)}:host([variant="subtle"]) .close-btn{color:var(--text-secondary);border-radius:var(--radius-full)}:host([variant="subtle"]) .close-btn:hover{color:var(--text-primary);background:var(--color-washi-200);transform:rotate(90deg)}:host([variant="subtle"]) .close-btn:active{transform:rotate(90deg) scale(.88);background:var(--color-washi-300)}:host([variant="outlined"]) .close-btn{color:var(--text-secondary);border:1px solid var(--border-default);border-radius:var(--radius-sm)}:host([variant="outlined"]) .close-btn:hover{color:var(--text-primary);background:var(--bg-surface);border-color:var(--border-strong)}:host([variant="outlined"]) .close-btn:active{transform:scale(.9)}:host([variant="filled"]) .close-btn{color:var(--bg-elevated);background:var(--color-washi-800);border-radius:var(--radius-sm)}:host([variant="filled"]) .close-btn:hover{background:var(--color-washi-900);transform:scale(1.05)}:host([variant="filled"]) .close-btn:active{transform:scale(.9)}:host([variant="filled-round"]) .close-btn{color:var(--bg-elevated);background:var(--color-washi-800);border-radius:var(--radius-full)}:host([variant="filled-round"]) .close-btn:hover{background:var(--color-washi-900);transform:rotate(90deg) scale(1.08)}:host([variant="filled-round"]) .close-btn:active{transform:rotate(90deg) scale(.9)}:host([variant="danger"]) .close-btn{color:var(--color-error);border-radius:var(--radius-sm)}:host([variant="danger"]) .close-btn:hover{color:var(--color-error);background:#651f241a}:host([variant="danger"]) .close-btn:active{transform:scale(.88)}:host([variant="danger"]) .close-btn:focus-visible{box-shadow:0 0 0 3px #651f2426}:host([variant="on-dark"]) .close-btn{color:#ffffff73;border-radius:var(--radius-full)}:host([variant="on-dark"]) .close-btn:hover{color:#ffffffe6;background:#ffffff1a;transform:rotate(90deg)}:host([variant="on-dark"]) .close-btn:active{transform:rotate(90deg) scale(.88)}:host([variant="on-dark"]) .close-btn:focus-visible{box-shadow:0 0 0 3px #fff3}@media(prefers-reduced-motion:reduce){.close-btn{transition:none}}}';
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
closeButtonCss as default
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=index293.js.map
|