@easemate/web-kit 0.1.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 +824 -0
- package/build/components/code/index.cjs +152 -0
- package/build/components/code/index.d.cts +11 -0
- package/build/components/code/index.d.ts +11 -0
- package/build/components/code/index.js +148 -0
- package/build/components/code/utils/highlight-api.cjs +18 -0
- package/build/components/code/utils/highlight-api.d.cts +7 -0
- package/build/components/code/utils/highlight-api.d.ts +7 -0
- package/build/components/code/utils/highlight-api.js +14 -0
- package/build/components/code/utils/syntax-grammars.cjs +62 -0
- package/build/components/code/utils/syntax-grammars.d.cts +7 -0
- package/build/components/code/utils/syntax-grammars.d.ts +7 -0
- package/build/components/code/utils/syntax-grammars.js +59 -0
- package/build/components/code/utils/syntax-highlighter-theme.cjs +27 -0
- package/build/components/code/utils/syntax-highlighter-theme.d.cts +3 -0
- package/build/components/code/utils/syntax-highlighter-theme.d.ts +3 -0
- package/build/components/code/utils/syntax-highlighter-theme.js +23 -0
- package/build/components/code/utils/syntax-highlighter-types.cjs +2 -0
- package/build/components/code/utils/syntax-highlighter-types.d.cts +12 -0
- package/build/components/code/utils/syntax-highlighter-types.d.ts +12 -0
- package/build/components/code/utils/syntax-highlighter-types.js +1 -0
- package/build/components/code/utils/syntax-tokenizer.cjs +63 -0
- package/build/components/code/utils/syntax-tokenizer.d.cts +3 -0
- package/build/components/code/utils/syntax-tokenizer.d.ts +3 -0
- package/build/components/code/utils/syntax-tokenizer.js +58 -0
- package/build/components/curve/bezier-conversion.cjs +23 -0
- package/build/components/curve/bezier-conversion.d.cts +2 -0
- package/build/components/curve/bezier-conversion.d.ts +2 -0
- package/build/components/curve/bezier-conversion.js +19 -0
- package/build/components/curve/canvas-controls.cjs +300 -0
- package/build/components/curve/canvas-controls.d.cts +12 -0
- package/build/components/curve/canvas-controls.d.ts +12 -0
- package/build/components/curve/canvas-controls.js +296 -0
- package/build/components/curve/canvas.cjs +1208 -0
- package/build/components/curve/canvas.d.cts +24 -0
- package/build/components/curve/canvas.d.ts +24 -0
- package/build/components/curve/canvas.js +1204 -0
- package/build/components/curve/constants.cjs +203 -0
- package/build/components/curve/constants.d.cts +23 -0
- package/build/components/curve/constants.d.ts +23 -0
- package/build/components/curve/constants.js +200 -0
- package/build/components/curve/controls.cjs +942 -0
- package/build/components/curve/controls.d.cts +37 -0
- package/build/components/curve/controls.d.ts +37 -0
- package/build/components/curve/controls.js +938 -0
- package/build/components/curve/index.cjs +335 -0
- package/build/components/curve/index.d.cts +31 -0
- package/build/components/curve/index.d.ts +31 -0
- package/build/components/curve/index.js +330 -0
- package/build/components/curve/output.cjs +141 -0
- package/build/components/curve/output.d.cts +19 -0
- package/build/components/curve/output.d.ts +19 -0
- package/build/components/curve/output.js +137 -0
- package/build/components/curve/styles.cjs +493 -0
- package/build/components/curve/styles.d.cts +6 -0
- package/build/components/curve/styles.d.ts +6 -0
- package/build/components/curve/styles.js +490 -0
- package/build/components/curve/svg-renderer.cjs +185 -0
- package/build/components/curve/svg-renderer.d.cts +9 -0
- package/build/components/curve/svg-renderer.d.ts +9 -0
- package/build/components/curve/svg-renderer.js +175 -0
- package/build/components/curve/toolbar.cjs +368 -0
- package/build/components/curve/toolbar.d.cts +26 -0
- package/build/components/curve/toolbar.d.ts +26 -0
- package/build/components/curve/toolbar.js +364 -0
- package/build/components/curve/types.cjs +10 -0
- package/build/components/curve/types.d.cts +33 -0
- package/build/components/curve/types.d.ts +33 -0
- package/build/components/curve/types.js +7 -0
- package/build/components/curve/utils.cjs +541 -0
- package/build/components/curve/utils.d.cts +33 -0
- package/build/components/curve/utils.d.ts +33 -0
- package/build/components/curve/utils.js +521 -0
- package/build/components/index.cjs +18 -0
- package/build/components/index.d.cts +2 -0
- package/build/components/index.d.ts +2 -0
- package/build/components/index.js +2 -0
- package/build/decorators/Component.cjs +127 -0
- package/build/decorators/Component.d.cts +28 -0
- package/build/decorators/Component.d.ts +28 -0
- package/build/decorators/Component.js +123 -0
- package/build/decorators/Listen.cjs +154 -0
- package/build/decorators/Listen.d.cts +18 -0
- package/build/decorators/Listen.d.ts +18 -0
- package/build/decorators/Listen.js +151 -0
- package/build/decorators/OutsideClick.cjs +64 -0
- package/build/decorators/OutsideClick.d.cts +16 -0
- package/build/decorators/OutsideClick.d.ts +16 -0
- package/build/decorators/OutsideClick.js +59 -0
- package/build/decorators/Prop.cjs +273 -0
- package/build/decorators/Prop.d.cts +22 -0
- package/build/decorators/Prop.d.ts +22 -0
- package/build/decorators/Prop.js +270 -0
- package/build/decorators/Query.cjs +79 -0
- package/build/decorators/Query.d.cts +27 -0
- package/build/decorators/Query.d.ts +27 -0
- package/build/decorators/Query.js +76 -0
- package/build/decorators/Watch.cjs +52 -0
- package/build/decorators/Watch.d.cts +11 -0
- package/build/decorators/Watch.d.ts +11 -0
- package/build/decorators/Watch.js +49 -0
- package/build/decorators/index.cjs +15 -0
- package/build/decorators/index.d.cts +6 -0
- package/build/decorators/index.d.ts +6 -0
- package/build/decorators/index.js +6 -0
- package/build/elements/button/index.cjs +214 -0
- package/build/elements/button/index.d.cts +11 -0
- package/build/elements/button/index.d.ts +11 -0
- package/build/elements/button/index.js +210 -0
- package/build/elements/checkbox/index.cjs +316 -0
- package/build/elements/checkbox/index.d.cts +14 -0
- package/build/elements/checkbox/index.d.ts +14 -0
- package/build/elements/checkbox/index.js +312 -0
- package/build/elements/color/index.cjs +154 -0
- package/build/elements/color/index.d.cts +18 -0
- package/build/elements/color/index.d.ts +18 -0
- package/build/elements/color/index.js +150 -0
- package/build/elements/color/picker.cjs +544 -0
- package/build/elements/color/picker.d.cts +37 -0
- package/build/elements/color/picker.d.ts +37 -0
- package/build/elements/color/picker.js +540 -0
- package/build/elements/color/utils.cjs +235 -0
- package/build/elements/color/utils.d.cts +37 -0
- package/build/elements/color/utils.d.ts +37 -0
- package/build/elements/color/utils.js +218 -0
- package/build/elements/dropdown/index.cjs +875 -0
- package/build/elements/dropdown/index.d.cts +30 -0
- package/build/elements/dropdown/index.d.ts +30 -0
- package/build/elements/dropdown/index.js +871 -0
- package/build/elements/field/index.cjs +82 -0
- package/build/elements/field/index.d.cts +4 -0
- package/build/elements/field/index.d.ts +4 -0
- package/build/elements/field/index.js +78 -0
- package/build/elements/icons/animation/chevron.cjs +57 -0
- package/build/elements/icons/animation/chevron.d.cts +10 -0
- package/build/elements/icons/animation/chevron.d.ts +10 -0
- package/build/elements/icons/animation/chevron.js +53 -0
- package/build/elements/icons/animation/clear.cjs +74 -0
- package/build/elements/icons/animation/clear.d.cts +3 -0
- package/build/elements/icons/animation/clear.d.ts +3 -0
- package/build/elements/icons/animation/clear.js +70 -0
- package/build/elements/icons/animation/grid.cjs +77 -0
- package/build/elements/icons/animation/grid.d.cts +8 -0
- package/build/elements/icons/animation/grid.d.ts +8 -0
- package/build/elements/icons/animation/grid.js +73 -0
- package/build/elements/icons/animation/loading.cjs +68 -0
- package/build/elements/icons/animation/loading.d.cts +3 -0
- package/build/elements/icons/animation/loading.d.ts +3 -0
- package/build/elements/icons/animation/loading.js +64 -0
- package/build/elements/icons/animation/snap.cjs +133 -0
- package/build/elements/icons/animation/snap.d.cts +8 -0
- package/build/elements/icons/animation/snap.d.ts +8 -0
- package/build/elements/icons/animation/snap.js +129 -0
- package/build/elements/icons/index.cjs +40 -0
- package/build/elements/icons/index.d.cts +24 -0
- package/build/elements/icons/index.d.ts +24 -0
- package/build/elements/icons/index.js +24 -0
- package/build/elements/icons/interface/anchor-add.cjs +35 -0
- package/build/elements/icons/interface/anchor-add.d.cts +3 -0
- package/build/elements/icons/interface/anchor-add.d.ts +3 -0
- package/build/elements/icons/interface/anchor-add.js +31 -0
- package/build/elements/icons/interface/anchor-remove.cjs +34 -0
- package/build/elements/icons/interface/anchor-remove.d.cts +3 -0
- package/build/elements/icons/interface/anchor-remove.d.ts +3 -0
- package/build/elements/icons/interface/anchor-remove.js +30 -0
- package/build/elements/icons/interface/arrow-up.cjs +30 -0
- package/build/elements/icons/interface/arrow-up.d.cts +3 -0
- package/build/elements/icons/interface/arrow-up.d.ts +3 -0
- package/build/elements/icons/interface/arrow-up.js +26 -0
- package/build/elements/icons/interface/arrows-vertical.cjs +30 -0
- package/build/elements/icons/interface/arrows-vertical.d.cts +3 -0
- package/build/elements/icons/interface/arrows-vertical.d.ts +3 -0
- package/build/elements/icons/interface/arrows-vertical.js +26 -0
- package/build/elements/icons/interface/bezier-angle.cjs +33 -0
- package/build/elements/icons/interface/bezier-angle.d.cts +3 -0
- package/build/elements/icons/interface/bezier-angle.d.ts +3 -0
- package/build/elements/icons/interface/bezier-angle.js +29 -0
- package/build/elements/icons/interface/bezier-distribute.cjs +34 -0
- package/build/elements/icons/interface/bezier-distribute.d.cts +3 -0
- package/build/elements/icons/interface/bezier-distribute.d.ts +3 -0
- package/build/elements/icons/interface/bezier-distribute.js +30 -0
- package/build/elements/icons/interface/bezier-length.cjs +31 -0
- package/build/elements/icons/interface/bezier-length.d.cts +3 -0
- package/build/elements/icons/interface/bezier-length.d.ts +3 -0
- package/build/elements/icons/interface/bezier-length.js +27 -0
- package/build/elements/icons/interface/bezier-mirror.cjs +31 -0
- package/build/elements/icons/interface/bezier-mirror.d.cts +3 -0
- package/build/elements/icons/interface/bezier-mirror.d.ts +3 -0
- package/build/elements/icons/interface/bezier-mirror.js +27 -0
- package/build/elements/icons/interface/bezier.cjs +26 -0
- package/build/elements/icons/interface/bezier.d.cts +3 -0
- package/build/elements/icons/interface/bezier.d.ts +3 -0
- package/build/elements/icons/interface/bezier.js +22 -0
- package/build/elements/icons/interface/check.cjs +30 -0
- package/build/elements/icons/interface/check.d.cts +3 -0
- package/build/elements/icons/interface/check.d.ts +3 -0
- package/build/elements/icons/interface/check.js +26 -0
- package/build/elements/icons/interface/circle-arrow-left.cjs +30 -0
- package/build/elements/icons/interface/circle-arrow-left.d.cts +3 -0
- package/build/elements/icons/interface/circle-arrow-left.d.ts +3 -0
- package/build/elements/icons/interface/circle-arrow-left.js +26 -0
- package/build/elements/icons/interface/circle-arrow-right.cjs +30 -0
- package/build/elements/icons/interface/circle-arrow-right.d.cts +3 -0
- package/build/elements/icons/interface/circle-arrow-right.d.ts +3 -0
- package/build/elements/icons/interface/circle-arrow-right.js +26 -0
- package/build/elements/icons/interface/code.cjs +30 -0
- package/build/elements/icons/interface/code.d.cts +3 -0
- package/build/elements/icons/interface/code.d.ts +3 -0
- package/build/elements/icons/interface/code.js +26 -0
- package/build/elements/icons/interface/dots.cjs +32 -0
- package/build/elements/icons/interface/dots.d.cts +3 -0
- package/build/elements/icons/interface/dots.d.ts +3 -0
- package/build/elements/icons/interface/dots.js +28 -0
- package/build/elements/icons/interface/mention.cjs +30 -0
- package/build/elements/icons/interface/mention.d.cts +3 -0
- package/build/elements/icons/interface/mention.d.ts +3 -0
- package/build/elements/icons/interface/mention.js +26 -0
- package/build/elements/icons/interface/minus.cjs +30 -0
- package/build/elements/icons/interface/minus.d.cts +3 -0
- package/build/elements/icons/interface/minus.d.ts +3 -0
- package/build/elements/icons/interface/minus.js +26 -0
- package/build/elements/icons/interface/picker.cjs +34 -0
- package/build/elements/icons/interface/picker.d.cts +3 -0
- package/build/elements/icons/interface/picker.d.ts +3 -0
- package/build/elements/icons/interface/picker.js +30 -0
- package/build/elements/icons/interface/plus.cjs +30 -0
- package/build/elements/icons/interface/plus.d.cts +3 -0
- package/build/elements/icons/interface/plus.d.ts +3 -0
- package/build/elements/icons/interface/plus.js +26 -0
- package/build/elements/icons/interface/settings.cjs +30 -0
- package/build/elements/icons/interface/settings.d.cts +3 -0
- package/build/elements/icons/interface/settings.d.ts +3 -0
- package/build/elements/icons/interface/settings.js +26 -0
- package/build/elements/index.cjs +62 -0
- package/build/elements/index.d.cts +22 -0
- package/build/elements/index.d.ts +22 -0
- package/build/elements/index.js +22 -0
- package/build/elements/input/index.cjs +273 -0
- package/build/elements/input/index.d.cts +17 -0
- package/build/elements/input/index.d.ts +17 -0
- package/build/elements/input/index.js +269 -0
- package/build/elements/logo/index.cjs +732 -0
- package/build/elements/logo/index.d.cts +17 -0
- package/build/elements/logo/index.d.ts +17 -0
- package/build/elements/logo/index.js +728 -0
- package/build/elements/monitor/fps.cjs +432 -0
- package/build/elements/monitor/fps.d.cts +21 -0
- package/build/elements/monitor/fps.d.ts +21 -0
- package/build/elements/monitor/fps.js +428 -0
- package/build/elements/monitor/index.cjs +670 -0
- package/build/elements/monitor/index.d.cts +112 -0
- package/build/elements/monitor/index.d.ts +112 -0
- package/build/elements/monitor/index.js +666 -0
- package/build/elements/number/index.cjs +173 -0
- package/build/elements/number/index.d.cts +19 -0
- package/build/elements/number/index.d.ts +19 -0
- package/build/elements/number/index.js +169 -0
- package/build/elements/origin/index.cjs +169 -0
- package/build/elements/origin/index.d.cts +12 -0
- package/build/elements/origin/index.d.ts +12 -0
- package/build/elements/origin/index.js +165 -0
- package/build/elements/popover/index.cjs +209 -0
- package/build/elements/popover/index.d.cts +19 -0
- package/build/elements/popover/index.d.ts +19 -0
- package/build/elements/popover/index.js +205 -0
- package/build/elements/radio/index.cjs +301 -0
- package/build/elements/radio/index.d.cts +13 -0
- package/build/elements/radio/index.d.ts +13 -0
- package/build/elements/radio/index.js +283 -0
- package/build/elements/radio/input.cjs +329 -0
- package/build/elements/radio/input.d.cts +15 -0
- package/build/elements/radio/input.d.ts +15 -0
- package/build/elements/radio/input.js +325 -0
- package/build/elements/radio/option.cjs +15 -0
- package/build/elements/radio/option.d.cts +3 -0
- package/build/elements/radio/option.d.ts +3 -0
- package/build/elements/radio/option.js +11 -0
- package/build/elements/shared.cjs +66 -0
- package/build/elements/shared.d.cts +40 -0
- package/build/elements/shared.d.ts +40 -0
- package/build/elements/shared.js +59 -0
- package/build/elements/slider/index.cjs +232 -0
- package/build/elements/slider/index.d.cts +20 -0
- package/build/elements/slider/index.d.ts +20 -0
- package/build/elements/slider/index.js +228 -0
- package/build/elements/state/index.cjs +681 -0
- package/build/elements/state/index.d.cts +86 -0
- package/build/elements/state/index.d.ts +86 -0
- package/build/elements/state/index.js +677 -0
- package/build/elements/toggle/index.cjs +151 -0
- package/build/elements/toggle/index.d.cts +9 -0
- package/build/elements/toggle/index.d.ts +9 -0
- package/build/elements/toggle/index.js +147 -0
- package/build/elements/tooltip/index.cjs +187 -0
- package/build/elements/tooltip/index.d.cts +17 -0
- package/build/elements/tooltip/index.d.ts +17 -0
- package/build/elements/tooltip/index.js +183 -0
- package/build/index.cjs +40 -0
- package/build/index.d.cts +6 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +12 -0
- package/build/init.cjs +325 -0
- package/build/init.d.cts +157 -0
- package/build/init.d.ts +157 -0
- package/build/init.js +289 -0
- package/build/internal/component-loaders.cjs +206 -0
- package/build/internal/component-loaders.d.cts +52 -0
- package/build/internal/component-loaders.d.ts +52 -0
- package/build/internal/component-loaders.js +167 -0
- package/build/internal/fonts.cjs +128 -0
- package/build/internal/fonts.d.cts +32 -0
- package/build/internal/fonts.d.ts +32 -0
- package/build/internal/fonts.js +123 -0
- package/build/internal/lazy-load.cjs +89 -0
- package/build/internal/lazy-load.d.cts +32 -0
- package/build/internal/lazy-load.d.ts +32 -0
- package/build/internal/lazy-load.js +86 -0
- package/build/internal/style-inject.cjs +236 -0
- package/build/internal/style-inject.d.cts +44 -0
- package/build/internal/style-inject.d.ts +44 -0
- package/build/internal/style-inject.js +226 -0
- package/build/register.cjs +36 -0
- package/build/register.d.cts +32 -0
- package/build/register.d.ts +32 -0
- package/build/register.js +34 -0
- package/build/theme/index.cjs +452 -0
- package/build/theme/index.d.cts +146 -0
- package/build/theme/index.d.ts +146 -0
- package/build/theme/index.js +423 -0
- package/build/theme/presets.cjs +54 -0
- package/build/theme/presets.d.cts +19 -0
- package/build/theme/presets.d.ts +19 -0
- package/build/theme/presets.js +51 -0
- package/build/theme/registry.cjs +204 -0
- package/build/theme/registry.d.cts +99 -0
- package/build/theme/registry.d.ts +99 -0
- package/build/theme/registry.js +194 -0
- package/build/theme/tokens.cjs +148 -0
- package/build/theme/tokens.d.cts +163 -0
- package/build/theme/tokens.d.ts +163 -0
- package/build/theme/tokens.js +145 -0
- package/build/utils/dismiss-controller.cjs +77 -0
- package/build/utils/dismiss-controller.d.cts +14 -0
- package/build/utils/dismiss-controller.d.ts +14 -0
- package/build/utils/dismiss-controller.js +73 -0
- package/build/utils/index.cjs +18 -0
- package/build/utils/index.d.cts +3 -0
- package/build/utils/index.d.ts +3 -0
- package/build/utils/index.js +3 -0
- package/build/utils/outside-click.cjs +82 -0
- package/build/utils/outside-click.d.cts +18 -0
- package/build/utils/outside-click.d.ts +18 -0
- package/build/utils/outside-click.js +74 -0
- package/build/utils/template-helpers.cjs +39 -0
- package/build/utils/template-helpers.d.cts +13 -0
- package/build/utils/template-helpers.d.ts +13 -0
- package/build/utils/template-helpers.js +28 -0
- package/package.json +96 -0
package/README.md
ADDED
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
# @easemate/web-kit
|
|
2
|
+
|
|
3
|
+
A modern, framework-agnostic UI kit of web components for building animation control panels.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Features](#features)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [Basic Usage](#basic-usage)
|
|
11
|
+
- [Selective Loading](#selective-loading)
|
|
12
|
+
- [Theme Switching](#theme-switching)
|
|
13
|
+
- [Components](#components)
|
|
14
|
+
- [Controls](#controls)
|
|
15
|
+
- [Layout & Display](#layout--display)
|
|
16
|
+
- [Advanced](#advanced)
|
|
17
|
+
- [Icons](#icons)
|
|
18
|
+
- [Usage Examples](#usage-examples)
|
|
19
|
+
- [Basic Controls](#basic-controls)
|
|
20
|
+
- [State Panel](#state-panel)
|
|
21
|
+
- [Header Actions](#header-actions)
|
|
22
|
+
- [Tabs](#tabs)
|
|
23
|
+
- [Tabs with Actions](#tabs-with-actions)
|
|
24
|
+
- [Footer](#footer)
|
|
25
|
+
- [JavaScript Integration](#javascript-integration)
|
|
26
|
+
- [Tab Control](#tab-control)
|
|
27
|
+
- [Event Handling](#event-handling)
|
|
28
|
+
- [Configuration](#configuration)
|
|
29
|
+
- [initWebKit Options](#initwebkit-options)
|
|
30
|
+
- [Theme Configuration](#theme-configuration)
|
|
31
|
+
- [Font Configuration](#font-configuration)
|
|
32
|
+
- [Lazy Loading](#lazy-loading)
|
|
33
|
+
- [Component Replacement](#component-replacement)
|
|
34
|
+
- [Theming](#theming)
|
|
35
|
+
- [CSS Custom Properties](#css-custom-properties)
|
|
36
|
+
- [JavaScript Theme API](#javascript-theme-api)
|
|
37
|
+
- [Token Reference](#token-reference)
|
|
38
|
+
- [API Reference](#api-reference)
|
|
39
|
+
- [Controller API](#controller-api)
|
|
40
|
+
- [Package Exports](#package-exports)
|
|
41
|
+
- [State Panel API](#state-panel-api)
|
|
42
|
+
- [Accessibility](#accessibility)
|
|
43
|
+
- [SSR Support](#ssr-support)
|
|
44
|
+
- [License](#license)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- 🎨 **Rich Component Library** — Sliders, toggles, color pickers, dropdowns, curve editors, and more
|
|
51
|
+
- 🌙 **Dark Theme by Default** — Beautiful dark UI with OKLAB color palette
|
|
52
|
+
- 🔌 **Framework Agnostic** — Works with vanilla JS, React, Vue, Svelte, or any framework
|
|
53
|
+
- 📦 **Tree-Shakeable** — Import only what you need
|
|
54
|
+
- 🎯 **TypeScript First** — Full type definitions included
|
|
55
|
+
- ♿ **Accessible** — ARIA attributes and keyboard navigation
|
|
56
|
+
- 🎭 **Customizable** — CSS custom properties and `::part` selectors for styling
|
|
57
|
+
- 📡 **State Aggregation** — Control panel state management with `<ease-state>`
|
|
58
|
+
- 🚀 **No CSS Import Required** — `initWebKit()` handles everything programmatically
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install @easemate/web-kit
|
|
66
|
+
# or
|
|
67
|
+
pnpm add @easemate/web-kit
|
|
68
|
+
# or
|
|
69
|
+
yarn add @easemate/web-kit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
### Basic Usage
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { initWebKit } from '@easemate/web-kit';
|
|
80
|
+
|
|
81
|
+
// Minimal - just register components
|
|
82
|
+
initWebKit();
|
|
83
|
+
|
|
84
|
+
// Full setup with theme, styles, and fonts
|
|
85
|
+
const kit = initWebKit({
|
|
86
|
+
theme: 'default',
|
|
87
|
+
styles: 'main',
|
|
88
|
+
fonts: 'default'
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Components are now registered and ready to use!
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This single call:
|
|
95
|
+
- Registers all custom elements
|
|
96
|
+
- Applies the dark theme variables
|
|
97
|
+
- Injects CSS reset and base styles
|
|
98
|
+
- Loads the default fonts (Instrument Sans, Geist Mono)
|
|
99
|
+
|
|
100
|
+
### Selective Loading
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { initWebKit } from '@easemate/web-kit';
|
|
104
|
+
|
|
105
|
+
// Only register specific components
|
|
106
|
+
initWebKit({
|
|
107
|
+
include: ['ease-button', 'ease-slider', 'ease-toggle'],
|
|
108
|
+
theme: 'default'
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Or exclude components you don't need
|
|
112
|
+
initWebKit({
|
|
113
|
+
exclude: ['ease-curve', 'ease-code'],
|
|
114
|
+
theme: 'default'
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Theme Switching
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { initWebKit, registerTheme } from '@easemate/web-kit';
|
|
122
|
+
|
|
123
|
+
// Register a custom light theme
|
|
124
|
+
registerTheme('light', {
|
|
125
|
+
base: null,
|
|
126
|
+
config: {
|
|
127
|
+
colors: {
|
|
128
|
+
gray: { 900: 'oklab(98% 0 0)', 0: 'oklab(20% 0 0)' },
|
|
129
|
+
foreground: 'var(--color-gray-0)'
|
|
130
|
+
},
|
|
131
|
+
vars: {
|
|
132
|
+
'--ease-panel-background': 'white',
|
|
133
|
+
'--ease-panel-border-color': 'color-mix(in oklab, black 10%, transparent)'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Initialize with system theme detection
|
|
139
|
+
const kit = initWebKit({
|
|
140
|
+
theme: {
|
|
141
|
+
mode: 'system', // 'light', 'dark', or 'system'
|
|
142
|
+
light: 'light',
|
|
143
|
+
dark: 'default'
|
|
144
|
+
},
|
|
145
|
+
styles: 'main',
|
|
146
|
+
fonts: 'default'
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Switch themes at runtime
|
|
150
|
+
kit.theme?.mode('dark');
|
|
151
|
+
kit.theme?.set('light');
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Components
|
|
157
|
+
|
|
158
|
+
### Controls
|
|
159
|
+
|
|
160
|
+
| Component | Tag | Description |
|
|
161
|
+
|-----------|-----|-------------|
|
|
162
|
+
| Slider | `<ease-slider>` | Range slider with min/max/step |
|
|
163
|
+
| Toggle | `<ease-toggle>` | Boolean switch |
|
|
164
|
+
| Checkbox | `<ease-checkbox>` | Checkbox input |
|
|
165
|
+
| Input | `<ease-input>` | Text input |
|
|
166
|
+
| NumberInput | `<ease-number-input>` | Numeric input with stepper |
|
|
167
|
+
| ColorInput | `<ease-color-input>` | Color input with picker |
|
|
168
|
+
| ColorPicker | `<ease-color-picker>` | Full color picker UI |
|
|
169
|
+
| Dropdown | `<ease-dropdown>` | Select dropdown |
|
|
170
|
+
| RadioGroup | `<ease-radio-group>` | Radio button group |
|
|
171
|
+
| RadioInput | `<ease-radio-input>` | Individual radio option |
|
|
172
|
+
| Origin | `<ease-origin>` | Transform origin picker |
|
|
173
|
+
|
|
174
|
+
### Layout & Display
|
|
175
|
+
|
|
176
|
+
| Component | Tag | Description |
|
|
177
|
+
|-----------|-----|-------------|
|
|
178
|
+
| State | `<ease-state>` | State aggregation panel |
|
|
179
|
+
| Field | `<ease-field>` | Label + control wrapper |
|
|
180
|
+
| Button | `<ease-button>` | Action button |
|
|
181
|
+
| Tooltip | `<ease-tooltip>` | Tooltip wrapper |
|
|
182
|
+
| Popover | `<ease-popover>` | Floating content |
|
|
183
|
+
|
|
184
|
+
### Advanced
|
|
185
|
+
|
|
186
|
+
| Component | Tag | Description |
|
|
187
|
+
|-----------|-----|-------------|
|
|
188
|
+
| Curve | `<ease-curve>` | Cubic bezier / linear easing editor |
|
|
189
|
+
| Code | `<ease-code>` | Syntax highlighted code |
|
|
190
|
+
| Monitor | `<ease-monitor>` | Value monitor display |
|
|
191
|
+
| MonitorFps | `<ease-monitor-fps>` | FPS counter |
|
|
192
|
+
| LogoLoader | `<ease-logo-loader>` | Animated logo with intro animations and loading state |
|
|
193
|
+
|
|
194
|
+
### Icons
|
|
195
|
+
|
|
196
|
+
All icon components follow the pattern `<ease-icon-*>`:
|
|
197
|
+
|
|
198
|
+
- `ease-icon-settings`, `ease-icon-dots`, `ease-icon-plus`, `ease-icon-minus`
|
|
199
|
+
- `ease-icon-check`, `ease-icon-chevron`, `ease-icon-code`
|
|
200
|
+
- `ease-icon-bezier`, `ease-icon-bezier-*` (bezier tools)
|
|
201
|
+
- `ease-icon-anchor-add`, `ease-icon-anchor-remove`
|
|
202
|
+
- And more...
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Usage Examples
|
|
207
|
+
|
|
208
|
+
### Basic Controls
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<ease-slider name="opacity" value="0.5" min="0" max="1" step="0.01"></ease-slider>
|
|
212
|
+
<ease-toggle name="visible" checked></ease-toggle>
|
|
213
|
+
<ease-color-input name="background" value="#3b82f6"></ease-color-input>
|
|
214
|
+
<ease-input name="label" value="Hello"></ease-input>
|
|
215
|
+
<ease-number-input name="count" value="42" min="0" max="100"></ease-number-input>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### State Panel
|
|
219
|
+
|
|
220
|
+
Basic panel with headline and controls:
|
|
221
|
+
|
|
222
|
+
```html
|
|
223
|
+
<ease-state>
|
|
224
|
+
<span slot="headline">Animation Controls</span>
|
|
225
|
+
<div slot="entry">
|
|
226
|
+
<ease-field label="Duration">
|
|
227
|
+
<ease-slider name="duration" value="1" min="0" max="5" step="0.1"></ease-slider>
|
|
228
|
+
</ease-field>
|
|
229
|
+
<ease-field label="Easing">
|
|
230
|
+
<ease-dropdown name="easing" value="ease-out">
|
|
231
|
+
<button slot="content" value="linear">Linear</button>
|
|
232
|
+
<button slot="content" value="ease-in">Ease In</button>
|
|
233
|
+
<button slot="content" value="ease-out">Ease Out</button>
|
|
234
|
+
<button slot="content" value="ease-in-out">Ease In-Out</button>
|
|
235
|
+
</ease-dropdown>
|
|
236
|
+
</ease-field>
|
|
237
|
+
<ease-field label="Loop">
|
|
238
|
+
<ease-toggle name="loop"></ease-toggle>
|
|
239
|
+
</ease-field>
|
|
240
|
+
</div>
|
|
241
|
+
</ease-state>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
#### Header Actions
|
|
245
|
+
|
|
246
|
+
Add action buttons, links, or dropdowns to the panel header using the `actions` slot:
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<ease-state>
|
|
250
|
+
<span slot="headline">Settings</span>
|
|
251
|
+
|
|
252
|
+
<!-- Action buttons -->
|
|
253
|
+
<button slot="actions" title="Settings">
|
|
254
|
+
<ease-icon-settings></ease-icon-settings>
|
|
255
|
+
</button>
|
|
256
|
+
<a slot="actions" href="/docs" title="Documentation">
|
|
257
|
+
<ease-icon-code></ease-icon-code>
|
|
258
|
+
</a>
|
|
259
|
+
|
|
260
|
+
<!-- Dropdown menu in actions -->
|
|
261
|
+
<ease-dropdown slot="actions">
|
|
262
|
+
<ease-icon-dots slot="trigger"></ease-icon-dots>
|
|
263
|
+
<button slot="content" value="export">Export</button>
|
|
264
|
+
<button slot="content" value="import">Import</button>
|
|
265
|
+
<button slot="content" value="reset">Reset</button>
|
|
266
|
+
</ease-dropdown>
|
|
267
|
+
|
|
268
|
+
<div slot="entry">
|
|
269
|
+
<!-- controls -->
|
|
270
|
+
</div>
|
|
271
|
+
</ease-state>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Action elements are automatically styled with hover states and proper spacing. Supported elements:
|
|
275
|
+
- `<button>` — Action button with icon
|
|
276
|
+
- `<a>` — Link with icon
|
|
277
|
+
- `<ease-dropdown>` — Dropdown menu (auto-positioned to bottom-end)
|
|
278
|
+
|
|
279
|
+
#### Tabs
|
|
280
|
+
|
|
281
|
+
Organize controls into tabbed sections (maximum 3 tabs). When tabs are present, the headline is automatically hidden.
|
|
282
|
+
|
|
283
|
+
```html
|
|
284
|
+
<ease-state active-tab="0">
|
|
285
|
+
<!-- Tab content uses slot="tab-{id}" pattern -->
|
|
286
|
+
<!-- Tab label comes from data-tab-label attribute -->
|
|
287
|
+
|
|
288
|
+
<div slot="tab-transform" data-tab-label="Transform">
|
|
289
|
+
<ease-field label="X">
|
|
290
|
+
<ease-number-input name="x" value="0"></ease-number-input>
|
|
291
|
+
</ease-field>
|
|
292
|
+
<ease-field label="Y">
|
|
293
|
+
<ease-number-input name="y" value="0"></ease-number-input>
|
|
294
|
+
</ease-field>
|
|
295
|
+
<ease-field label="Rotation">
|
|
296
|
+
<ease-slider name="rotation" value="0" min="0" max="360"></ease-slider>
|
|
297
|
+
</ease-field>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div slot="tab-style" data-tab-label="Style">
|
|
301
|
+
<ease-field label="Opacity">
|
|
302
|
+
<ease-slider name="opacity" value="1" min="0" max="1" step="0.01"></ease-slider>
|
|
303
|
+
</ease-field>
|
|
304
|
+
<ease-field label="Color">
|
|
305
|
+
<ease-color-input name="color" value="#3b82f6"></ease-color-input>
|
|
306
|
+
</ease-field>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<div slot="tab-animation" data-tab-label="Animation">
|
|
310
|
+
<ease-field label="Duration">
|
|
311
|
+
<ease-slider name="duration" value="1" min="0" max="5" step="0.1"></ease-slider>
|
|
312
|
+
</ease-field>
|
|
313
|
+
<ease-field label="Delay">
|
|
314
|
+
<ease-slider name="delay" value="0" min="0" max="2" step="0.1"></ease-slider>
|
|
315
|
+
</ease-field>
|
|
316
|
+
</div>
|
|
317
|
+
</ease-state>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Tab Attributes:**
|
|
321
|
+
|
|
322
|
+
| Attribute | Description |
|
|
323
|
+
|-----------|-------------|
|
|
324
|
+
| `slot="tab-{id}"` | Assigns content to a tab. The `id` is used internally and for events. |
|
|
325
|
+
| `data-tab-label` | Display label for the tab button. Falls back to `id` if not provided. |
|
|
326
|
+
| `active-tab` | (on `<ease-state>`) Zero-based index of the initially active tab. |
|
|
327
|
+
|
|
328
|
+
**Tab Behavior:**
|
|
329
|
+
- Tabs are detected automatically from slotted elements with `slot="tab-*"` pattern
|
|
330
|
+
- Maximum of 3 tabs supported
|
|
331
|
+
- Switching tabs triggers a smooth crossfade animation with height transition
|
|
332
|
+
- Keyboard navigation: Arrow keys, Home, End
|
|
333
|
+
- State is tracked per-tab (only active tab's controls are in the state object)
|
|
334
|
+
|
|
335
|
+
#### Tabs with Actions
|
|
336
|
+
|
|
337
|
+
Combine tabs and header actions:
|
|
338
|
+
|
|
339
|
+
```html
|
|
340
|
+
<ease-state active-tab="0">
|
|
341
|
+
<!-- Actions appear to the right of tabs -->
|
|
342
|
+
<button slot="actions" title="Reset">
|
|
343
|
+
<ease-icon-minus></ease-icon-minus>
|
|
344
|
+
</button>
|
|
345
|
+
|
|
346
|
+
<div slot="tab-basic" data-tab-label="Basic">
|
|
347
|
+
<!-- controls -->
|
|
348
|
+
</div>
|
|
349
|
+
<div slot="tab-advanced" data-tab-label="Advanced">
|
|
350
|
+
<!-- controls -->
|
|
351
|
+
</div>
|
|
352
|
+
</ease-state>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### Footer
|
|
356
|
+
|
|
357
|
+
Add footer content that appears below all tab panels:
|
|
358
|
+
|
|
359
|
+
```html
|
|
360
|
+
<ease-state>
|
|
361
|
+
<span slot="headline">Controls</span>
|
|
362
|
+
<div slot="entry">
|
|
363
|
+
<!-- controls -->
|
|
364
|
+
</div>
|
|
365
|
+
<div slot="footer">
|
|
366
|
+
<ease-button>Apply</ease-button>
|
|
367
|
+
<ease-button variant="secondary">Cancel</ease-button>
|
|
368
|
+
</div>
|
|
369
|
+
</ease-state>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### JavaScript Integration
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
const state = document.querySelector('ease-state');
|
|
376
|
+
|
|
377
|
+
// Get current state
|
|
378
|
+
console.log(state.state); // { duration: 1, easing: 'ease-out', loop: false }
|
|
379
|
+
|
|
380
|
+
// Get individual value
|
|
381
|
+
const duration = state.get('duration');
|
|
382
|
+
|
|
383
|
+
// Set value programmatically
|
|
384
|
+
state.set('duration', 2.5);
|
|
385
|
+
|
|
386
|
+
// Subscribe to changes
|
|
387
|
+
const sub = state.subscribe((value, name) => {
|
|
388
|
+
console.log(`${name} changed to:`, value);
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// Subscribe to specific control
|
|
392
|
+
state.subscribe('duration', (value) => {
|
|
393
|
+
myAnimation.duration = value;
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// Reset to initial values
|
|
397
|
+
state.reset();
|
|
398
|
+
|
|
399
|
+
// Cleanup
|
|
400
|
+
sub.unsubscribe();
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### Tab Control
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
const state = document.querySelector('ease-state');
|
|
407
|
+
|
|
408
|
+
// Get current active tab index
|
|
409
|
+
console.log(state.activeTab); // 0
|
|
410
|
+
|
|
411
|
+
// Switch to a specific tab programmatically
|
|
412
|
+
state.setTab(1); // Switch to second tab (0-indexed)
|
|
413
|
+
|
|
414
|
+
// Or set directly via property
|
|
415
|
+
state.activeTab = 2;
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Logo Loader
|
|
419
|
+
|
|
420
|
+
The `<ease-logo-loader>` component displays an animated logo with intro animations and an optional loading state.
|
|
421
|
+
|
|
422
|
+
```html
|
|
423
|
+
<!-- Basic usage - plays wave intro on load -->
|
|
424
|
+
<ease-logo-loader></ease-logo-loader>
|
|
425
|
+
|
|
426
|
+
<!-- With particle intro animation -->
|
|
427
|
+
<ease-logo-loader intro="particle"></ease-logo-loader>
|
|
428
|
+
|
|
429
|
+
<!-- With loading state -->
|
|
430
|
+
<ease-logo-loader loading></ease-logo-loader>
|
|
431
|
+
|
|
432
|
+
<!-- Custom size -->
|
|
433
|
+
<ease-logo-loader size="48"></ease-logo-loader>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Logo Loader Attributes
|
|
437
|
+
|
|
438
|
+
| Attribute | Type | Default | Description |
|
|
439
|
+
|-----------|------|---------|-------------|
|
|
440
|
+
| `intro` | `'wave' \| 'particle'` | `'wave'` | Intro animation variant played on mount |
|
|
441
|
+
| `loading` | `boolean` | `false` | When true, plays continuous loading animation |
|
|
442
|
+
| `size` | `number` | `36` | Size in pixels |
|
|
443
|
+
| `aria-label` | `string` | - | Accessible label for the logo |
|
|
444
|
+
|
|
445
|
+
#### Intro Animations
|
|
446
|
+
|
|
447
|
+
- **Wave** (default): Inner dots appear at half scale, then expand while outer dots fade in with a staggered wave effect
|
|
448
|
+
- **Particle**: Dots fly in from outside with curved bezier paths, rotation, and shockwave effects on impact
|
|
449
|
+
|
|
450
|
+
#### Loading Animation
|
|
451
|
+
|
|
452
|
+
When the `loading` attribute is set:
|
|
453
|
+
1. Inner dots scale down and pulse with a breathing effect
|
|
454
|
+
2. Outer dots animate in a circular wave pattern
|
|
455
|
+
3. Animation completes its current cycle before stopping when `loading` is removed
|
|
456
|
+
|
|
457
|
+
#### JavaScript API
|
|
458
|
+
|
|
459
|
+
```typescript
|
|
460
|
+
const logo = document.querySelector('ease-logo-loader');
|
|
461
|
+
|
|
462
|
+
// Toggle loading state
|
|
463
|
+
logo.loading = true;
|
|
464
|
+
logo.loading = false;
|
|
465
|
+
|
|
466
|
+
// Replay intro animation
|
|
467
|
+
logo.playIntro(); // Uses current intro variant
|
|
468
|
+
logo.playIntro('wave'); // Force wave intro
|
|
469
|
+
logo.playIntro('particle'); // Force particle intro
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
#### Theming
|
|
473
|
+
|
|
474
|
+
The logo uses theme color tokens:
|
|
475
|
+
|
|
476
|
+
| CSS Variable | Default | Description |
|
|
477
|
+
|--------------|---------|-------------|
|
|
478
|
+
| `--dot-dark` | `var(--color-gray-0)` | Brightest dot color (inner dots) |
|
|
479
|
+
| `--dot-medium` | `var(--color-gray-600)` | Medium dot color |
|
|
480
|
+
| `--dot-light` | `var(--color-gray-700)` | Dimmest dot color (outer dots) |
|
|
481
|
+
| `--dot-accent` | `var(--color-blue-600)` | Accent color for effects |
|
|
482
|
+
|
|
483
|
+
### Event Handling
|
|
484
|
+
|
|
485
|
+
All controls dispatch standard events:
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
// Standard control-change event
|
|
489
|
+
slider.addEventListener('control-change', (e: CustomEvent) => {
|
|
490
|
+
const { name, value, event } = e.detail;
|
|
491
|
+
console.log(`${name}: ${value}`);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
// State aggregator events
|
|
495
|
+
state.addEventListener('state-change', (e: CustomEvent) => {
|
|
496
|
+
const { name, value, state } = e.detail;
|
|
497
|
+
console.log('Full state:', state);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// Tab change event
|
|
501
|
+
state.addEventListener('tab-change', (e: CustomEvent) => {
|
|
502
|
+
const { index, id, event } = e.detail;
|
|
503
|
+
console.log(`Switched to tab ${id} (index: ${index})`);
|
|
504
|
+
});
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
#### Event Types
|
|
508
|
+
|
|
509
|
+
| Event | Detail | Description |
|
|
510
|
+
|-------|--------|-------------|
|
|
511
|
+
| `control-change` | `{ name, value, event }` | Fired by individual controls when value changes |
|
|
512
|
+
| `state-change` | `{ name, value, state, event }` | Fired by `<ease-state>` when any control changes |
|
|
513
|
+
| `tab-change` | `{ index, id, event }` | Fired by `<ease-state>` when active tab changes |
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## Configuration
|
|
518
|
+
|
|
519
|
+
### initWebKit Options
|
|
520
|
+
|
|
521
|
+
| Option | Type | Default | Description |
|
|
522
|
+
|--------|------|---------|-------------|
|
|
523
|
+
| `include` | `string[]` | - | Only register these component tags |
|
|
524
|
+
| `exclude` | `string[]` | - | Register all except these tags |
|
|
525
|
+
| `replace` | `Record<string, Constructor \| string>` | - | Replace components with custom implementations |
|
|
526
|
+
| `theme` | `string \| ThemeRef \| ThemeConfig \| ThemeModeConfig` | - | Theme to apply |
|
|
527
|
+
| `target` | `HTMLElement` | `document.documentElement` | Element to scope theme vars to |
|
|
528
|
+
| `styles` | `false \| 'reset' \| 'base' \| 'main'` | `false` | Inject global styles |
|
|
529
|
+
| `fonts` | `false \| 'default' \| FontConfig` | `false` | Font loading configuration |
|
|
530
|
+
| `lazyLoad` | `boolean \| LazyLoadConfig` | `false` | Enable lazy component loading |
|
|
531
|
+
| `cspNonce` | `string` | - | CSP nonce for injected elements |
|
|
532
|
+
| `dev` | `{ warnUnknownTags?: boolean; logLoads?: boolean }` | - | Development options |
|
|
533
|
+
|
|
534
|
+
### Theme Configuration
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
// Theme mode configuration for light/dark switching
|
|
538
|
+
interface ThemeModeConfig {
|
|
539
|
+
mode: 'light' | 'dark' | 'system';
|
|
540
|
+
light: ThemeInput;
|
|
541
|
+
dark: ThemeInput;
|
|
542
|
+
persist?: { key: string }; // Coming soon
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Custom theme registration
|
|
546
|
+
import { initWebKit, registerTheme } from '@easemate/web-kit';
|
|
547
|
+
|
|
548
|
+
const brandTheme = registerTheme('brand', {
|
|
549
|
+
base: 'default', // Inherit from default
|
|
550
|
+
config: {
|
|
551
|
+
typography: {
|
|
552
|
+
fontFamily: '"Inter", system-ui, sans-serif'
|
|
553
|
+
},
|
|
554
|
+
vars: {
|
|
555
|
+
'--ease-panel-radius': '16px',
|
|
556
|
+
'--ease-panel-padding': '16px'
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
initWebKit({ theme: brandTheme });
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### Font Configuration
|
|
565
|
+
|
|
566
|
+
```typescript
|
|
567
|
+
// Use default fonts (Instrument Sans, Geist Mono)
|
|
568
|
+
fonts: 'default'
|
|
569
|
+
|
|
570
|
+
// Custom Google fonts
|
|
571
|
+
fonts: {
|
|
572
|
+
'Inter': { source: 'google', family: 'Inter', css2: 'wght@400..700' },
|
|
573
|
+
'JetBrains Mono': { source: 'google', family: 'JetBrains Mono' }
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// Self-hosted fonts
|
|
577
|
+
fonts: {
|
|
578
|
+
'Custom Font': { source: 'css', url: '/fonts/custom.css' }
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Lazy Loading
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
initWebKit({
|
|
586
|
+
lazyLoad: true, // Auto-define components when they appear in DOM
|
|
587
|
+
theme: 'default'
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// Advanced lazy loading
|
|
591
|
+
initWebKit({
|
|
592
|
+
lazyLoad: {
|
|
593
|
+
strategy: 'mutation',
|
|
594
|
+
include: ['ease-slider', 'ease-toggle'],
|
|
595
|
+
preload: ['ease-button'] // Load immediately
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### Component Replacement
|
|
601
|
+
|
|
602
|
+
```typescript
|
|
603
|
+
import { initWebKit } from '@easemate/web-kit';
|
|
604
|
+
import { CustomInput } from './custom-input';
|
|
605
|
+
|
|
606
|
+
initWebKit({
|
|
607
|
+
replace: {
|
|
608
|
+
'ease-input': CustomInput, // Your custom element class
|
|
609
|
+
// or alias to another tag:
|
|
610
|
+
// 'ease-input': 'my-custom-input'
|
|
611
|
+
},
|
|
612
|
+
theme: 'default'
|
|
613
|
+
});
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## Theming
|
|
619
|
+
|
|
620
|
+
### CSS Custom Properties
|
|
621
|
+
|
|
622
|
+
All components use CSS custom properties. Override them at any scope:
|
|
623
|
+
|
|
624
|
+
```css
|
|
625
|
+
:root {
|
|
626
|
+
--ease-panel-padding: 16px;
|
|
627
|
+
--ease-panel-radius: 14px;
|
|
628
|
+
--ease-button-radius: 8px;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/* Or scope to specific containers */
|
|
632
|
+
.my-panel {
|
|
633
|
+
--ease-panel-background: var(--my-bg);
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Multiple themes using `data-ease-theme`:
|
|
638
|
+
|
|
639
|
+
```css
|
|
640
|
+
:root[data-ease-theme='dark'] {
|
|
641
|
+
--ease-panel-background: var(--color-gray-1000);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
:root[data-ease-theme='light'] {
|
|
645
|
+
--ease-panel-background: white;
|
|
646
|
+
}
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### JavaScript Theme API
|
|
650
|
+
|
|
651
|
+
```typescript
|
|
652
|
+
import { applyTheme, createTheme, mergeTheme, setThemeName } from '@easemate/web-kit/theme';
|
|
653
|
+
|
|
654
|
+
// Merge with defaults
|
|
655
|
+
const theme = mergeTheme({
|
|
656
|
+
vars: { '--ease-panel-padding': '16px' }
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
// Apply to document
|
|
660
|
+
applyTheme(theme, { name: 'custom', colorScheme: 'dark' });
|
|
661
|
+
|
|
662
|
+
// Generate CSS string
|
|
663
|
+
const css = createTheme(theme, ':root[data-ease-theme="custom"]');
|
|
664
|
+
|
|
665
|
+
// Switch theme name
|
|
666
|
+
setThemeName('light', { colorScheme: 'light' });
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Token Reference
|
|
670
|
+
|
|
671
|
+
#### Global Tokens
|
|
672
|
+
|
|
673
|
+
| Category | Variables |
|
|
674
|
+
|----------|-----------|
|
|
675
|
+
| Colors | `--color-gray-*`, `--color-blue-*`, `--color-green-*`, `--color-red-*`, `--color-orange-*`, `--color-yellow-*` |
|
|
676
|
+
| Radii | `--radii-sm`, `--radii-md`, `--radii-lg`, `--radii-xl`, `--radii-full` |
|
|
677
|
+
| Spacing | `--spacing-xs`, `--spacing-sm`, `--spacing-md`, `--spacing-lg`, `--spacing-xl` |
|
|
678
|
+
| Typography | `--font-family`, `--font-mono`, `--font-size`, `--font-line-height` |
|
|
679
|
+
|
|
680
|
+
#### UI Kit Tokens (`--ease-*`)
|
|
681
|
+
|
|
682
|
+
| Category | Variables |
|
|
683
|
+
|----------|-----------|
|
|
684
|
+
| Typography | `--ease-font-family`, `--ease-font-mono`, `--ease-font-size`, `--ease-line-height` |
|
|
685
|
+
| Panel | `--ease-panel-max-width`, `--ease-panel-padding`, `--ease-panel-radius`, `--ease-panel-background`, `--ease-panel-border-color`, `--ease-panel-shadow` |
|
|
686
|
+
| Panel Title | `--ease-panel-title-font-size`, `--ease-panel-title-font-weight`, `--ease-panel-title-line-height`, `--ease-panel-title-color` |
|
|
687
|
+
| Panel Tabs | `--ease-panel-tab-font-size`, `--ease-panel-tab-font-weight`, `--ease-panel-tab-line-height`, `--ease-panel-tab-color`, `--ease-panel-tab-color-hover`, `--ease-panel-tab-color-active`, `--ease-panel-tab-background-active`, `--ease-panel-tab-radius` |
|
|
688
|
+
| Panel Actions | `--ease-panel-action-icon-size` |
|
|
689
|
+
| Panel Footer | `--ease-panel-footer-padding` |
|
|
690
|
+
| State Transitions | `--ease-state-transition-duration`, `--ease-state-transition-easing` |
|
|
691
|
+
| Field | `--ease-field-label-width`, `--ease-field-column-gap`, `--ease-field-row-gap` |
|
|
692
|
+
| Controls | Each control exposes `--ease-<component>-*` tokens |
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
## API Reference
|
|
697
|
+
|
|
698
|
+
### Controller API
|
|
699
|
+
|
|
700
|
+
`initWebKit()` returns a controller object:
|
|
701
|
+
|
|
702
|
+
```typescript
|
|
703
|
+
interface WebKitController {
|
|
704
|
+
dispose: () => void; // Cleanup all injected resources
|
|
705
|
+
ready: Promise<void>; // Resolves when components are loaded
|
|
706
|
+
theme?: {
|
|
707
|
+
set: (theme) => void; // Set theme by name/ref/config
|
|
708
|
+
mode?: (mode) => void; // Set mode (light/dark/system)
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
### Package Exports
|
|
714
|
+
|
|
715
|
+
| Export | Description |
|
|
716
|
+
|--------|-------------|
|
|
717
|
+
| `@easemate/web-kit` | Main entry (initWebKit + theme + types) |
|
|
718
|
+
| `@easemate/web-kit/register` | Side-effect registration (all components) |
|
|
719
|
+
| `@easemate/web-kit/elements` | UI components only |
|
|
720
|
+
| `@easemate/web-kit/decorators` | Component decorators |
|
|
721
|
+
| `@easemate/web-kit/theme` | Theming utilities |
|
|
722
|
+
| `@easemate/web-kit/utils` | Utility functions |
|
|
723
|
+
| `@easemate/web-kit/styles/*` | CSS assets (optional) |
|
|
724
|
+
|
|
725
|
+
### State Panel API
|
|
726
|
+
|
|
727
|
+
The `<ease-state>` component provides a complete API for state management.
|
|
728
|
+
|
|
729
|
+
#### Properties
|
|
730
|
+
|
|
731
|
+
| Property | Type | Default | Description |
|
|
732
|
+
|----------|------|---------|-------------|
|
|
733
|
+
| `value` | `string \| null` | `null` | Legacy: reflects the last changed control's value |
|
|
734
|
+
| `activeTab` | `number` | `0` | Zero-based index of the active tab |
|
|
735
|
+
| `state` | `Record<string, unknown>` | `{}` | Read-only object containing all control values |
|
|
736
|
+
|
|
737
|
+
#### Methods
|
|
738
|
+
|
|
739
|
+
| Method | Signature | Description |
|
|
740
|
+
|--------|-----------|-------------|
|
|
741
|
+
| `get` | `(name: string) => unknown` | Get a specific control value by name |
|
|
742
|
+
| `set` | `(name: string, value: unknown) => void` | Set a control value programmatically |
|
|
743
|
+
| `subscribe` | `(callback: (value, name) => void) => { unsubscribe }` | Subscribe to all state changes |
|
|
744
|
+
| `subscribe` | `(name: string, callback: (value, name) => void) => { unsubscribe }` | Subscribe to a specific control |
|
|
745
|
+
| `reset` | `() => void` | Reset all controls to their initial values |
|
|
746
|
+
| `setTab` | `(index: number) => void` | Switch to a specific tab by index |
|
|
747
|
+
|
|
748
|
+
#### Slots
|
|
749
|
+
|
|
750
|
+
| Slot | Description |
|
|
751
|
+
|------|-------------|
|
|
752
|
+
| `headline` | Panel title text (hidden when tabs are present) |
|
|
753
|
+
| `actions` | Header action buttons, links, or dropdowns |
|
|
754
|
+
| `entry` | Main content area (used when no tabs) |
|
|
755
|
+
| `tab-{id}` | Tab panel content (use `data-tab-label` for display name) |
|
|
756
|
+
| `footer` | Footer content below all panels |
|
|
757
|
+
|
|
758
|
+
#### CSS Parts
|
|
759
|
+
|
|
760
|
+
| Part | Description |
|
|
761
|
+
|------|-------------|
|
|
762
|
+
| `section` | Outer container |
|
|
763
|
+
| `header` | Header row containing headline/tabs and actions |
|
|
764
|
+
| `headline` | Title element |
|
|
765
|
+
| `tabs` | Tab button container |
|
|
766
|
+
| `tab` | Individual tab button |
|
|
767
|
+
| `actions` | Actions container |
|
|
768
|
+
| `content` | Content wrapper (handles height animations) |
|
|
769
|
+
| `form` | Inner form container |
|
|
770
|
+
| `tab-panel` | Individual tab panel |
|
|
771
|
+
| `footer` | Footer container |
|
|
772
|
+
|
|
773
|
+
#### Events
|
|
774
|
+
|
|
775
|
+
| Event | Detail Type | Description |
|
|
776
|
+
|-------|-------------|-------------|
|
|
777
|
+
| `state-change` | `StateChangeEventDetail` | Fired when any control value changes |
|
|
778
|
+
| `tab-change` | `TabChangeEventDetail` | Fired when the active tab changes |
|
|
779
|
+
|
|
780
|
+
```typescript
|
|
781
|
+
interface StateChangeEventDetail {
|
|
782
|
+
name: string; // Control name
|
|
783
|
+
value: unknown; // New value
|
|
784
|
+
state: Record<string, unknown>; // Complete state object
|
|
785
|
+
event: Event; // Original event
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
interface TabChangeEventDetail {
|
|
789
|
+
index: number; // Tab index (0-based)
|
|
790
|
+
id: string; // Tab id from slot name
|
|
791
|
+
event: Event; // Original event
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
## Accessibility
|
|
798
|
+
|
|
799
|
+
Components include:
|
|
800
|
+
- ARIA attributes (`role`, `aria-*`)
|
|
801
|
+
- Keyboard navigation (Tab, Arrow keys, Enter, Escape)
|
|
802
|
+
- Focus management
|
|
803
|
+
- Screen reader support
|
|
804
|
+
- `disabled` state handling
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
## SSR Support
|
|
809
|
+
|
|
810
|
+
The package is SSR-safe. `initWebKit()` is a no-op in server environments:
|
|
811
|
+
|
|
812
|
+
```typescript
|
|
813
|
+
import { initWebKit } from '@easemate/web-kit';
|
|
814
|
+
|
|
815
|
+
// Safe on server - returns immediately without side effects
|
|
816
|
+
const kit = initWebKit({ theme: 'default' });
|
|
817
|
+
await kit.ready; // Resolves immediately on server
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
---
|
|
821
|
+
|
|
822
|
+
## License
|
|
823
|
+
|
|
824
|
+
MIT © [Aaron Iker](https://github.com/aaroniker)
|