@easemate/web-kit 0.3.1 → 0.3.3
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 +203 -19
- package/build/index.cjs +4986 -2313
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +4977 -2304
- package/build/index.js.map +1 -1
- package/build/{init-B7gNNyTd.d.ts → init-CaP7khA2.d.ts} +1 -1
- package/build/{init-DwVGVxkx.d.cts → init-DmqoRv6_.d.cts} +1 -1
- package/build/jsx.cjs.map +1 -1
- package/build/jsx.d.cts +42 -7
- package/build/jsx.d.ts +42 -7
- package/build/jsx.js.map +1 -1
- package/build/react.cjs +4174 -1529
- package/build/react.cjs.map +1 -1
- package/build/react.d.cts +3 -3
- package/build/react.d.ts +3 -3
- package/build/react.js +4173 -1528
- package/build/react.js.map +1 -1
- package/build/register.cjs +3924 -1213
- package/build/register.cjs.map +1 -1
- package/build/register.js +3924 -1213
- package/build/register.js.map +1 -1
- package/build/{registry-9GX9KTG1.d.cts → registry-YCv1Ctoe.d.cts} +32 -24
- package/build/{registry-9GX9KTG1.d.ts → registry-YCv1Ctoe.d.ts} +32 -24
- package/build/theme.cjs.map +1 -1
- package/build/theme.d.cts +2 -2
- package/build/theme.d.ts +2 -2
- package/build/theme.js.map +1 -1
- package/package.json +2 -12
package/README.md
CHANGED
|
@@ -48,6 +48,10 @@ A modern, framework-agnostic UI kit of web components for building animation con
|
|
|
48
48
|
- [Configuration](#configuration)
|
|
49
49
|
- [initWebKit Options](#initwebkit-options)
|
|
50
50
|
- [Theme Configuration](#theme-configuration)
|
|
51
|
+
- [Custom Theme Registration](#custom-theme-registration)
|
|
52
|
+
- [Theme Inheritance](#theme-inheritance)
|
|
53
|
+
- [Creating a Theme from Scratch](#creating-a-theme-from-scratch)
|
|
54
|
+
- [Theme Utilities](#theme-utilities)
|
|
51
55
|
- [Font Configuration](#font-configuration)
|
|
52
56
|
- [Lazy Loading](#lazy-loading)
|
|
53
57
|
- [Component Replacement](#component-replacement)
|
|
@@ -62,6 +66,8 @@ A modern, framework-agnostic UI kit of web components for building animation con
|
|
|
62
66
|
- [State API](#state-api)
|
|
63
67
|
- [Accessibility](#accessibility)
|
|
64
68
|
- [SSR Support](#ssr-support)
|
|
69
|
+
- [Links](#links)
|
|
70
|
+
- [Authors](#authors)
|
|
65
71
|
- [License](#license)
|
|
66
72
|
|
|
67
73
|
---
|
|
@@ -182,7 +188,11 @@ The library provides first-class React integration via `@easemate/web-kit/react`
|
|
|
182
188
|
|
|
183
189
|
### JSX Types
|
|
184
190
|
|
|
185
|
-
Importing `@easemate/web-kit/react` automatically adds JSX types for all `ease-*` custom elements:
|
|
191
|
+
Importing `@easemate/web-kit/react` automatically adds JSX types for all `ease-*` custom elements, including:
|
|
192
|
+
- All control components (`ease-slider`, `ease-toggle`, `ease-input`, etc.)
|
|
193
|
+
- Layout components (`ease-panel`, `ease-state`, `ease-field`, etc.)
|
|
194
|
+
- Advanced components (`ease-curve`, `ease-code`, `ease-monitor-fps`, etc.)
|
|
195
|
+
- All icon components (`ease-icon-settings`, `ease-icon-bezier`, etc.)
|
|
186
196
|
|
|
187
197
|
```tsx
|
|
188
198
|
import '@easemate/web-kit/react';
|
|
@@ -193,12 +203,26 @@ import '@easemate/web-kit/react';
|
|
|
193
203
|
</ease-panel>
|
|
194
204
|
```
|
|
195
205
|
|
|
196
|
-
You can also import just the JSX types separately:
|
|
206
|
+
You can also import just the JSX types separately (useful for type-only imports):
|
|
197
207
|
|
|
198
208
|
```tsx
|
|
199
209
|
import '@easemate/web-kit/react/jsx';
|
|
200
210
|
```
|
|
201
211
|
|
|
212
|
+
The types include proper ref types for accessing component methods:
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import type { StateElement, PanelElement } from '@easemate/web-kit/react';
|
|
216
|
+
|
|
217
|
+
const stateRef = useRef<StateElement>(null);
|
|
218
|
+
const panelRef = useRef<PanelElement>(null);
|
|
219
|
+
|
|
220
|
+
// Access typed methods
|
|
221
|
+
stateRef.current?.get('volume');
|
|
222
|
+
stateRef.current?.reset();
|
|
223
|
+
panelRef.current?.setActiveTab(1);
|
|
224
|
+
```
|
|
225
|
+
|
|
202
226
|
### Basic Setup
|
|
203
227
|
|
|
204
228
|
```tsx
|
|
@@ -458,13 +482,39 @@ const handleChange = createEventHandler<ControlChangeEvent>((e) => {
|
|
|
458
482
|
|
|
459
483
|
### Icons
|
|
460
484
|
|
|
461
|
-
All icon components follow the pattern `<ease-icon
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
-
|
|
485
|
+
All icon components follow the pattern `<ease-icon-*>`. All icons are typed in JSX when importing `@easemate/web-kit/react`.
|
|
486
|
+
|
|
487
|
+
**Interface Icons:**
|
|
488
|
+
| Tag | Description |
|
|
489
|
+
|-----|-------------|
|
|
490
|
+
| `ease-icon-settings` | Settings gear icon |
|
|
491
|
+
| `ease-icon-dots` | Three dots / more menu icon |
|
|
492
|
+
| `ease-icon-plus` | Plus / add icon |
|
|
493
|
+
| `ease-icon-minus` | Minus / remove icon |
|
|
494
|
+
| `ease-icon-check` | Checkmark icon |
|
|
495
|
+
| `ease-icon-code` | Code brackets icon |
|
|
496
|
+
| `ease-icon-picker` | Eyedropper picker icon |
|
|
497
|
+
| `ease-icon-mention` | @ mention icon |
|
|
498
|
+
| `ease-icon-arrow-up` | Up arrow icon |
|
|
499
|
+
| `ease-icon-arrows-vertical` | Vertical arrows icon |
|
|
500
|
+
| `ease-icon-circle-arrow-left` | Left arrow in circle |
|
|
501
|
+
| `ease-icon-circle-arrow-right` | Right arrow in circle |
|
|
502
|
+
| `ease-icon-anchor-add` | Add anchor point |
|
|
503
|
+
| `ease-icon-anchor-remove` | Remove anchor point |
|
|
504
|
+
| `ease-icon-bezier` | Bezier curve icon |
|
|
505
|
+
| `ease-icon-bezier-angle` | Bezier angle tool |
|
|
506
|
+
| `ease-icon-bezier-distribute` | Distribute bezier points |
|
|
507
|
+
| `ease-icon-bezier-length` | Bezier length tool |
|
|
508
|
+
| `ease-icon-bezier-mirror` | Mirror bezier handles |
|
|
509
|
+
|
|
510
|
+
**Animation Icons:**
|
|
511
|
+
| Tag | Description |
|
|
512
|
+
|-----|-------------|
|
|
513
|
+
| `ease-icon-chevron` | Animated chevron (expands/collapses) |
|
|
514
|
+
| `ease-icon-clear` | Animated clear/X icon |
|
|
515
|
+
| `ease-icon-grid` | Animated grid icon |
|
|
516
|
+
| `ease-icon-loading` | Animated loading spinner |
|
|
517
|
+
| `ease-icon-snap` | Animated snap indicator |
|
|
468
518
|
|
|
469
519
|
---
|
|
470
520
|
|
|
@@ -785,12 +835,18 @@ interface ThemeModeConfig {
|
|
|
785
835
|
dark: ThemeInput;
|
|
786
836
|
persist?: { key: string }; // Coming soon
|
|
787
837
|
}
|
|
838
|
+
```
|
|
788
839
|
|
|
789
|
-
|
|
840
|
+
#### Custom Theme Registration
|
|
841
|
+
|
|
842
|
+
Register custom themes using `registerTheme()`. No TypeScript declaration files needed - custom theme names are fully supported:
|
|
843
|
+
|
|
844
|
+
```typescript
|
|
790
845
|
import { initWebKit, registerTheme } from '@easemate/web-kit';
|
|
791
846
|
|
|
847
|
+
// Register a custom theme - returns a typed theme ref
|
|
792
848
|
const brandTheme = registerTheme('brand', {
|
|
793
|
-
base: 'default', // Inherit from default
|
|
849
|
+
base: 'default', // Inherit from built-in theme ('default' or 'dark')
|
|
794
850
|
config: {
|
|
795
851
|
typography: {
|
|
796
852
|
fontFamily: '"Inter", system-ui, sans-serif'
|
|
@@ -802,7 +858,99 @@ const brandTheme = registerTheme('brand', {
|
|
|
802
858
|
}
|
|
803
859
|
});
|
|
804
860
|
|
|
861
|
+
// Use the theme ref (type-safe)
|
|
805
862
|
initWebKit({ theme: brandTheme });
|
|
863
|
+
|
|
864
|
+
// Or use the string name directly (also works!)
|
|
865
|
+
initWebKit({ theme: 'brand' });
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
#### Theme Inheritance
|
|
869
|
+
|
|
870
|
+
Themes can extend other themes using the `base` option:
|
|
871
|
+
|
|
872
|
+
```typescript
|
|
873
|
+
// Create a base brand theme
|
|
874
|
+
const brandBase = registerTheme('brand-base', {
|
|
875
|
+
base: 'default',
|
|
876
|
+
config: {
|
|
877
|
+
typography: { fontFamily: '"Inter", sans-serif' },
|
|
878
|
+
vars: { '--ease-panel-radius': '16px' }
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
// Create variants that extend brand-base
|
|
883
|
+
const brandLight = registerTheme('brand-light', {
|
|
884
|
+
base: brandBase, // Can use theme ref or string name
|
|
885
|
+
config: {
|
|
886
|
+
colors: {
|
|
887
|
+
gray: { 900: 'oklab(98% 0 0)', 0: 'oklab(20% 0 0)' }
|
|
888
|
+
},
|
|
889
|
+
vars: { '--ease-panel-background': 'white' }
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
const brandDark = registerTheme('brand-dark', {
|
|
894
|
+
base: 'brand-base', // String name works too
|
|
895
|
+
config: {
|
|
896
|
+
vars: { '--ease-panel-background': 'var(--color-gray-1000)' }
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
// Use with theme mode switching
|
|
901
|
+
initWebKit({
|
|
902
|
+
theme: {
|
|
903
|
+
mode: 'system',
|
|
904
|
+
light: brandLight,
|
|
905
|
+
dark: brandDark
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
#### Creating a Theme from Scratch
|
|
911
|
+
|
|
912
|
+
Use `base: null` to create a theme without inheriting defaults:
|
|
913
|
+
|
|
914
|
+
```typescript
|
|
915
|
+
const minimalTheme = registerTheme('minimal', {
|
|
916
|
+
base: null, // Start fresh, no inheritance
|
|
917
|
+
config: {
|
|
918
|
+
colors: {
|
|
919
|
+
gray: { 900: '#f5f5f5', 0: '#171717' },
|
|
920
|
+
blue: { 500: '#3b82f6' }
|
|
921
|
+
},
|
|
922
|
+
vars: {
|
|
923
|
+
'--ease-panel-background': 'white',
|
|
924
|
+
'--ease-panel-border-color': '#e5e5e5'
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
#### Theme Utilities
|
|
931
|
+
|
|
932
|
+
```typescript
|
|
933
|
+
import {
|
|
934
|
+
registerTheme,
|
|
935
|
+
getTheme,
|
|
936
|
+
hasTheme,
|
|
937
|
+
getThemeNames,
|
|
938
|
+
themeRef
|
|
939
|
+
} from '@easemate/web-kit';
|
|
940
|
+
|
|
941
|
+
// Check if a theme exists
|
|
942
|
+
if (hasTheme('brand')) {
|
|
943
|
+
console.log('Brand theme is registered');
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// Get all registered theme names
|
|
947
|
+
const themes = getThemeNames(); // ['default', 'dark', 'brand', ...]
|
|
948
|
+
|
|
949
|
+
// Get resolved theme config (with inheritance applied)
|
|
950
|
+
const config = getTheme('brand');
|
|
951
|
+
|
|
952
|
+
// Get a theme ref for an already-registered theme
|
|
953
|
+
const ref = themeRef('brand');
|
|
806
954
|
```
|
|
807
955
|
|
|
808
956
|
### Font Configuration
|
|
@@ -958,14 +1106,14 @@ interface WebKitController {
|
|
|
958
1106
|
|
|
959
1107
|
| Export | Description |
|
|
960
1108
|
|--------|-------------|
|
|
961
|
-
| `@easemate/web-kit` | Main entry (
|
|
962
|
-
| `@easemate/web-kit/react` | React hooks, utilities, and JSX types |
|
|
963
|
-
| `@easemate/web-kit/react/jsx` | JSX type augmentation only |
|
|
964
|
-
| `@easemate/web-kit/register` | Side-effect
|
|
965
|
-
| `@easemate/web-kit/elements` |
|
|
966
|
-
| `@easemate/web-kit/decorators` | Component decorators |
|
|
967
|
-
| `@easemate/web-kit/theme` |
|
|
968
|
-
| `@easemate/web-kit/utils` |
|
|
1109
|
+
| `@easemate/web-kit` | Main entry: `initWebKit()`, theme utilities, and all types |
|
|
1110
|
+
| `@easemate/web-kit/react` | React hooks (`useWebKit`, `useEaseState`), provider, event utilities, and JSX types |
|
|
1111
|
+
| `@easemate/web-kit/react/jsx` | JSX type augmentation only (for TypeScript) |
|
|
1112
|
+
| `@easemate/web-kit/register` | Side-effect import that registers all components (SSR-safe) |
|
|
1113
|
+
| `@easemate/web-kit/elements` | Individual element classes (`Button`, `Slider`, `Panel`, etc.) |
|
|
1114
|
+
| `@easemate/web-kit/decorators` | `@Component`, `@Prop`, `@Watch`, `@Listen`, `@Query` decorators |
|
|
1115
|
+
| `@easemate/web-kit/theme` | Theme API: `applyTheme`, `createTheme`, `mergeTheme`, `registerTheme` |
|
|
1116
|
+
| `@easemate/web-kit/utils` | Template helpers: `classMap`, `styleMap`, `when`, `repeat`, etc. |
|
|
969
1117
|
|
|
970
1118
|
### Panel API
|
|
971
1119
|
|
|
@@ -1105,6 +1253,42 @@ const { ready, theme } = useWebKitContext();
|
|
|
1105
1253
|
|
|
1106
1254
|
---
|
|
1107
1255
|
|
|
1256
|
+
## Links
|
|
1257
|
+
|
|
1258
|
+
- [Website](https://ease.dev)
|
|
1259
|
+
- [Demo](https://ease.zip)
|
|
1260
|
+
- [𝕏](https://x.com/@easemate)
|
|
1261
|
+
- [GitHub](https://github.com/easemate)
|
|
1262
|
+
- [npm](https://www.npmjs.com/package/@easemate/web-kit)
|
|
1263
|
+
|
|
1264
|
+
## Authors
|
|
1265
|
+
|
|
1266
|
+
<p><strong>Aaron Iker</strong></p>
|
|
1267
|
+
<p valign="center">
|
|
1268
|
+
<a href="https://x.com/aaroniker">
|
|
1269
|
+
<img valign="top" src="https://img.shields.io/badge/@aaroniker-black?style=flat-square&logo=x" alt="X">
|
|
1270
|
+
</a>
|
|
1271
|
+
<span valign="center"> • </span>
|
|
1272
|
+
<a href="https://github.com/aaroniker">
|
|
1273
|
+
<img valign="top" src="https://img.shields.io/badge/GitHub-aaroniker-black?style=flat-square&logo=github" alt="GitHub">
|
|
1274
|
+
</a>
|
|
1275
|
+
<span valign="center"> • </span>
|
|
1276
|
+
<a href="https://www.linkedin.com/in/aaron-iker-15606897/">
|
|
1277
|
+
<img valign="top" src="https://img.shields.io/badge/LinkedIn-aaroniker-blue?style=flat-square&logo=linkedin" alt="LinkedIn">
|
|
1278
|
+
</a>
|
|
1279
|
+
</p>
|
|
1280
|
+
|
|
1281
|
+
<p><strong>Jakub Antalik</strong></p>
|
|
1282
|
+
<p valign="center">
|
|
1283
|
+
<a href="https://x.com/jakubantalik">
|
|
1284
|
+
<img valign="top" src="https://img.shields.io/badge/@jakubantalik-black?style=flat-square&logo=x" alt="X">
|
|
1285
|
+
</a>
|
|
1286
|
+
<span valign="center"> • </span>
|
|
1287
|
+
<a href="https://www.linkedin.com/in/jakubantalik/">
|
|
1288
|
+
<img valign="top" src="https://img.shields.io/badge/LinkedIn-jakubantalik-blue?style=flat-square&logo=linkedin" alt="LinkedIn">
|
|
1289
|
+
</a>
|
|
1290
|
+
</p>
|
|
1291
|
+
|
|
1108
1292
|
## License
|
|
1109
1293
|
|
|
1110
1294
|
MIT © [Aaron Iker](https://github.com/aaroniker)
|