lapikit 0.0.0-insiders.fb2e87e → 0.0.0-insiders.fbd9b54

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.
Files changed (61) hide show
  1. package/bin/configuration.js +22 -0
  2. package/bin/helper.js +23 -0
  3. package/bin/index.js +41 -0
  4. package/bin/lapikit.js +37 -5
  5. package/bin/legacy.js +34 -0
  6. package/bin/modules/adapter.js +3 -3
  7. package/bin/modules/plugin.js +223 -0
  8. package/bin/prompts.js +101 -0
  9. package/dist/assets/icons/arrow-down.svelte +2 -0
  10. package/dist/assets/icons/arrow-down.svelte.d.ts +6 -14
  11. package/dist/assets/icons/arrow-up.svelte +2 -0
  12. package/dist/assets/icons/arrow-up.svelte.d.ts +6 -14
  13. package/dist/assets/icons/close-fill.svelte +2 -0
  14. package/dist/assets/icons/close-fill.svelte.d.ts +6 -14
  15. package/dist/assets/icons/loading-fill.svelte +2 -0
  16. package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
  17. package/dist/components/accordion/accordion.css +6 -6
  18. package/dist/components/alert/alert.css +19 -9
  19. package/dist/components/app/app.css +1 -1
  20. package/dist/components/appbar/appbar.css +2 -2
  21. package/dist/components/appbar/appbar.svelte +0 -1
  22. package/dist/components/aspect-ratio/aspect-ratio.svelte +0 -1
  23. package/dist/components/avatar/avatar.css +5 -5
  24. package/dist/components/button/button.css +165 -194
  25. package/dist/components/button/button.svelte +39 -31
  26. package/dist/components/button/button.svelte.d.ts +2 -2
  27. package/dist/components/button/types.d.ts +7 -5
  28. package/dist/components/card/card.css +64 -58
  29. package/dist/components/card/card.svelte +14 -1
  30. package/dist/components/card/types.d.ts +1 -1
  31. package/dist/components/chip/chip.css +114 -82
  32. package/dist/components/chip/chip.svelte +18 -7
  33. package/dist/components/chip/types.d.ts +2 -1
  34. package/dist/components/dialog/dialog.css +2 -2
  35. package/dist/components/dropdown/dropdown.css +4 -4
  36. package/dist/components/icon/icon.css +14 -11
  37. package/dist/components/index.d.ts +2 -1
  38. package/dist/components/index.js +2 -1
  39. package/dist/components/list/list.css +145 -119
  40. package/dist/components/list/list.svelte +1 -3
  41. package/dist/components/list/modules/list-item.svelte +9 -1
  42. package/dist/components/list/types.d.ts +2 -5
  43. package/dist/components/modal/modal.css +10 -6
  44. package/dist/components/modal/modal.svelte +1 -0
  45. package/dist/components/popover/popover.css +4 -4
  46. package/dist/components/separator/separator.css +1 -1
  47. package/dist/components/textfield/textfield.css +305 -0
  48. package/dist/components/textfield/textfield.svelte +193 -0
  49. package/dist/components/textfield/textfield.svelte.d.ts +4 -0
  50. package/dist/components/textfield/types.d.ts +37 -0
  51. package/dist/components/textfield/types.js +1 -0
  52. package/dist/components/toolbar/toolbar.css +6 -6
  53. package/dist/components/tooltip/tooltip.css +4 -4
  54. package/dist/internal/assets.svelte.js +2 -0
  55. package/dist/internal/ripple.d.ts +12 -0
  56. package/dist/internal/ripple.js +93 -0
  57. package/dist/preset.js +1 -1
  58. package/dist/style/animation.css +42 -0
  59. package/dist/style/normalize.css +2 -0
  60. package/dist/style/parser/color.js +2 -2
  61. package/package.json +7 -3
@@ -0,0 +1,93 @@
1
+ const triggerEvents = ['pointerdown', 'touchstart', 'keydown'];
2
+ const cancelEvents = ['mouseleave', 'dragleave', 'touchmove', 'touchcancel', 'pointerup', 'keyup'];
3
+ export function ripple(el, options = {}) {
4
+ const rippleContainer = document.createElement('div');
5
+ addClasses();
6
+ setOptions(options);
7
+ function addClasses(center) {
8
+ const shouldBeCentered = center || options.center;
9
+ if (!rippleContainer.classList.contains('kit-ripple--effect')) {
10
+ rippleContainer.classList.add('kit-ripple--effect');
11
+ }
12
+ if (!shouldBeCentered && rippleContainer.classList.contains('kit-ripple--center')) {
13
+ rippleContainer.classList.remove('kit-ripple--center');
14
+ }
15
+ if (shouldBeCentered) {
16
+ rippleContainer.classList.add('kit-ripple--center');
17
+ }
18
+ }
19
+ function setOptions(options) {
20
+ if (options.disabled || el.hasAttribute('aria-disabled')) {
21
+ rippleContainer.remove();
22
+ }
23
+ else {
24
+ el.appendChild(rippleContainer);
25
+ }
26
+ if (options.duration && options.duration < 0) {
27
+ options.duration = undefined;
28
+ }
29
+ if (options.component) {
30
+ rippleContainer.style.setProperty('--ripple-radius', `var(--${options.component}-radius)`);
31
+ }
32
+ if (options.color) {
33
+ rippleContainer.style.setProperty('--ripple-color', options.color);
34
+ }
35
+ if (options.duration) {
36
+ rippleContainer.style.setProperty('--ripple-duration', `${options.duration}ms`);
37
+ }
38
+ }
39
+ function createRipple(e, center) {
40
+ if (options.disabled || el.hasAttribute('aria-disabled')) {
41
+ return;
42
+ }
43
+ if (e instanceof KeyboardEvent) {
44
+ if (!['Enter', 'Space'].includes(e.code) || e.repeat) {
45
+ return;
46
+ }
47
+ e.preventDefault();
48
+ const click = new PointerEvent('pointerdown');
49
+ createRipple(click, true);
50
+ return;
51
+ }
52
+ addClasses(center);
53
+ const rect = el.getBoundingClientRect();
54
+ const clientX = window.TouchEvent && e instanceof TouchEvent
55
+ ? e.touches[0].clientX
56
+ : e.clientX;
57
+ const clientY = window.TouchEvent && e instanceof TouchEvent
58
+ ? e.touches[0].clientY
59
+ : e.clientY;
60
+ const x = clientX - rect.left > el.offsetWidth / 2 ? 0 : el.offsetWidth;
61
+ const y = clientY - rect.top > el.offsetHeight / 2 ? 0 : el.offsetHeight;
62
+ const radius = Math.hypot(x - (clientX - rect.left), y - (clientY - rect.top));
63
+ const ripple = document.createElement('div');
64
+ ripple.classList.add('kit-ripple');
65
+ ripple.style.left = `${clientX - rect.left - radius}px`;
66
+ ripple.style.top = `${clientY - rect.top - radius}px`;
67
+ ripple.style.width = ripple.style.height = `${radius * 2}px`;
68
+ rippleContainer.appendChild(ripple);
69
+ function removeRipple() {
70
+ if (ripple === null) {
71
+ return;
72
+ }
73
+ ripple.style.opacity = '0';
74
+ setTimeout(() => {
75
+ ripple.remove();
76
+ }, options.duration || 1000);
77
+ cancelEvents.forEach((event) => el.removeEventListener(event, removeRipple));
78
+ }
79
+ cancelEvents.forEach((event) => el.addEventListener(event, removeRipple, { passive: true }));
80
+ }
81
+ triggerEvents.forEach((event) => el.addEventListener(event, createRipple, { passive: event === 'touchstart' }));
82
+ return {
83
+ destroy() {
84
+ triggerEvents.forEach((event) => {
85
+ el.removeEventListener(event, createRipple);
86
+ });
87
+ },
88
+ update(newOptions) {
89
+ options = newOptions;
90
+ setOptions(newOptions);
91
+ }
92
+ };
93
+ }
package/dist/preset.js CHANGED
@@ -4,7 +4,7 @@ export const config = {
4
4
  minify: false // true | false
5
5
  },
6
6
  theme: {
7
- colorScheme: 'dark', // 'light' | 'dark' | 'auto'
7
+ colorScheme: 'system', // 'light' | 'dark' | 'system'
8
8
  colors: {
9
9
  primary: { light: 'oklch(45% 0.24 277.023)', dark: 'oklch(45% 0.24 277.023)' },
10
10
  'on-primary': { light: 'oklch(14% 0.005 285.823)', dark: 'oklch(14% 0.005 285.823)' },
@@ -18,3 +18,45 @@
18
18
  transform: rotate(380deg);
19
19
  }
20
20
  }
21
+
22
+ .kit-ripple {
23
+ background-color: currentColor;
24
+ opacity: 0.1;
25
+ position: absolute;
26
+ border-radius: 50%;
27
+ pointer-events: none;
28
+ -webkit-transition: 0.6s;
29
+ transition: 0.6s;
30
+ -webkit-animation: lapikit-ripple var(--ripple-duration, 0.4s) cubic-bezier(0.4, 0, 0.2, 1);
31
+ animation: lapikit-ripple var(--ripple-duration, 0.4s) cubic-bezier(0.4, 0, 0.2, 1);
32
+ border-radius: var(--ripple-radius);
33
+ }
34
+
35
+ .kit-ripple--center {
36
+ top: 50% !important;
37
+ left: 50% !important;
38
+ translate: -50% -50% !important;
39
+ }
40
+
41
+ .kit-ripple--effect {
42
+ position: absolute;
43
+ left: 0;
44
+ right: 0;
45
+ top: 0;
46
+ bottom: 0;
47
+ overflow: hidden;
48
+ background: none;
49
+ pointer-events: none;
50
+ z-index: 999;
51
+ border-radius: var(--ripple-radius);
52
+ }
53
+
54
+ @keyframes lapikit-ripple {
55
+ from {
56
+ scale: 0;
57
+ }
58
+
59
+ to {
60
+ scale: 1;
61
+ }
62
+ }
@@ -4,6 +4,8 @@ html {
4
4
  line-height: 1.5;
5
5
  box-sizing: border-box;
6
6
  font-family: var(--kit-font-family-sans);
7
+ background-color: var(--kit-base);
8
+ color: var(--kit-on-base);
7
9
  }
8
10
 
9
11
  pre,
@@ -38,7 +38,7 @@ export const colors = (config) => {
38
38
  }
39
39
  cssVariables += `}\n`;
40
40
  cssVariables += `.${inversed} {\n`;
41
- cssVariables += `color-scheme: ${used};\n`;
41
+ cssVariables += `color-scheme: ${inversed};\n`;
42
42
  for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
43
43
  cssVariables += `--kit-${colorName}: ${colorValue};\n`;
44
44
  }
@@ -56,7 +56,7 @@ export const colors = (config) => {
56
56
  }
57
57
  cssVariables += `}\n`;
58
58
  cssVariables += `.${inversed} {\n`;
59
- cssVariables += `color-scheme: ${used};\n`;
59
+ cssVariables += `color-scheme: ${inversed};\n`;
60
60
  for (const [colorName, colorValue] of Object.entries(schemes[inversed])) {
61
61
  cssVariables += `--kit-${colorName}: ${colorValue};\n`;
62
62
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.0.0-insiders.fb2e87e",
3
+ "version": "0.0.0-insiders.fbd9b54",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
+ "homepage": "https://lapikit.dev",
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "git+https://github.com/Nycolaide/lapikit.git",
@@ -35,7 +36,7 @@
35
36
  "**/*.css"
36
37
  ],
37
38
  "bin": {
38
- "lapikit": "bin/lapikit.js"
39
+ "lapikit": "bin/index.js"
39
40
  },
40
41
  "svelte": "./dist/index.js",
41
42
  "types": "./dist/index.d.ts",
@@ -89,5 +90,8 @@
89
90
  },
90
91
  "keywords": [
91
92
  "svelte"
92
- ]
93
+ ],
94
+ "dependencies": {
95
+ "prompts": "^2.4.2"
96
+ }
93
97
  }