@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type QueryRoot = 'shadow' | 'light' | 'document';
|
|
2
|
+
type QueryHost = HTMLElement & {
|
|
3
|
+
renderRoot?: ShadowRoot | DocumentFragment | HTMLElement;
|
|
4
|
+
};
|
|
5
|
+
type QueryFallback<TResult, THost extends QueryHost> = TResult | ((host: THost) => TResult);
|
|
6
|
+
interface BaseQueryOptions<TResult, THost extends QueryHost> {
|
|
7
|
+
from?: QueryRoot;
|
|
8
|
+
fallback?: QueryFallback<TResult, THost>;
|
|
9
|
+
}
|
|
10
|
+
interface QueryAllOptions<TElement extends Element, THost extends QueryHost> extends BaseQueryOptions<TElement[], THost> {
|
|
11
|
+
all: true;
|
|
12
|
+
closest?: false;
|
|
13
|
+
}
|
|
14
|
+
interface QueryClosestOptions<THost extends QueryHost> extends BaseQueryOptions<Element | null, THost> {
|
|
15
|
+
closest: true;
|
|
16
|
+
all?: false;
|
|
17
|
+
}
|
|
18
|
+
interface QuerySingleOptions<TElement extends Element, THost extends QueryHost> extends BaseQueryOptions<TElement | null, THost> {
|
|
19
|
+
all?: false;
|
|
20
|
+
closest?: false;
|
|
21
|
+
}
|
|
22
|
+
type QueryOptions<TElement extends Element, THost extends QueryHost> = QueryAllOptions<TElement, THost> | QueryClosestOptions<THost> | QuerySingleOptions<TElement, THost>;
|
|
23
|
+
type QueryReturnType<TElement extends Element, THost extends QueryHost, TOptions extends QueryOptions<TElement, THost>> = TOptions extends QueryAllOptions<TElement, THost> ? TElement[] : TOptions extends QueryClosestOptions<THost> ? Element | null : TElement | null;
|
|
24
|
+
type QueryDecorator<TElement extends Element, THost extends QueryHost, TOptions extends QueryOptions<TElement, THost>> = (target: ClassAccessorDecoratorTarget<THost, QueryReturnType<TElement, THost, TOptions>> | undefined, context: ClassFieldDecoratorContext<THost, QueryReturnType<TElement, THost, TOptions>> | ClassAccessorDecoratorContext<THost, QueryReturnType<TElement, THost, TOptions>>) => ClassAccessorDecoratorResult<THost, QueryReturnType<TElement, THost, TOptions>> | undefined;
|
|
25
|
+
export declare function Query<TElement extends Element, THost extends QueryHost, TOptions extends QueryOptions<TElement, THost>>(selector: string, userOptions: TOptions): QueryDecorator<TElement, THost, TOptions>;
|
|
26
|
+
export declare function Query<TElement extends Element = Element, THost extends QueryHost = QueryHost>(selector: string): QueryDecorator<TElement, THost, QuerySingleOptions<TElement, THost>>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const defaultOptions = {
|
|
2
|
+
all: false,
|
|
3
|
+
closest: false,
|
|
4
|
+
from: 'shadow',
|
|
5
|
+
fallback: null
|
|
6
|
+
};
|
|
7
|
+
const resolveFallback = (fallback, host) => {
|
|
8
|
+
if (typeof fallback === 'function') {
|
|
9
|
+
return fallback(host);
|
|
10
|
+
}
|
|
11
|
+
return fallback;
|
|
12
|
+
};
|
|
13
|
+
const resolveRoot = (host, option) => {
|
|
14
|
+
switch (option) {
|
|
15
|
+
case 'document':
|
|
16
|
+
return document;
|
|
17
|
+
case 'light':
|
|
18
|
+
return host;
|
|
19
|
+
default:
|
|
20
|
+
return host.renderRoot ?? host.shadowRoot ?? host;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const resolveQuery = (host, selector, options) => {
|
|
24
|
+
if (options.closest) {
|
|
25
|
+
const result = host.closest(selector);
|
|
26
|
+
return result ?? resolveFallback(options.fallback, host) ?? null;
|
|
27
|
+
}
|
|
28
|
+
const root = resolveRoot(host, options.from);
|
|
29
|
+
if (!root) {
|
|
30
|
+
return options.all
|
|
31
|
+
? (resolveFallback(options.fallback, host) ?? [])
|
|
32
|
+
: (resolveFallback(options.fallback, host) ?? null);
|
|
33
|
+
}
|
|
34
|
+
if (options.all) {
|
|
35
|
+
const elements = Array.from(root.querySelectorAll(selector));
|
|
36
|
+
return elements.length > 0
|
|
37
|
+
? elements
|
|
38
|
+
: (resolveFallback(options.fallback, host) ?? []);
|
|
39
|
+
}
|
|
40
|
+
const match = root.querySelector(selector);
|
|
41
|
+
return match ?? resolveFallback(options.fallback, host) ?? null;
|
|
42
|
+
};
|
|
43
|
+
const createQueryDecorator = (selector, options) => {
|
|
44
|
+
return (_target, context) => {
|
|
45
|
+
if (context.kind === 'accessor') {
|
|
46
|
+
const descriptor = {
|
|
47
|
+
get() {
|
|
48
|
+
return resolveQuery(this, selector, options);
|
|
49
|
+
},
|
|
50
|
+
set(_value) {
|
|
51
|
+
// Readonly accessor
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return descriptor;
|
|
55
|
+
}
|
|
56
|
+
context.addInitializer(function () {
|
|
57
|
+
Object.defineProperty(this, context.name, {
|
|
58
|
+
configurable: true,
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: () => resolveQuery(this, selector, options)
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export function Query(selector, userOptions) {
|
|
67
|
+
if (!selector) {
|
|
68
|
+
throw new Error('@Query requires a selector.');
|
|
69
|
+
}
|
|
70
|
+
if (userOptions) {
|
|
71
|
+
const merged = { ...defaultOptions, ...userOptions };
|
|
72
|
+
return createQueryDecorator(selector, merged);
|
|
73
|
+
}
|
|
74
|
+
const merged = defaultOptions;
|
|
75
|
+
return createQueryDecorator(selector, merged);
|
|
76
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Watch = Watch;
|
|
4
|
+
const renderQueue = new WeakMap();
|
|
5
|
+
const scheduleRender = (instance) => {
|
|
6
|
+
if (typeof instance.requestRender === 'function') {
|
|
7
|
+
instance.requestRender();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (typeof instance.render !== 'function') {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (renderQueue.get(instance)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
renderQueue.set(instance, true);
|
|
17
|
+
requestAnimationFrame(() => {
|
|
18
|
+
renderQueue.set(instance, false);
|
|
19
|
+
instance.render?.();
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const defaultCompare = (previous, next) => previous === next;
|
|
23
|
+
function Watch(options = {}) {
|
|
24
|
+
const { compare = defaultCompare, onChange, transform } = options;
|
|
25
|
+
return (accessor, context) => {
|
|
26
|
+
if (context.kind !== 'accessor') {
|
|
27
|
+
throw new Error('@Watch requires the "accessor" keyword on the property.');
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
get() {
|
|
31
|
+
return accessor.get.call(this);
|
|
32
|
+
},
|
|
33
|
+
set(value) {
|
|
34
|
+
const previous = accessor.get.call(this);
|
|
35
|
+
if (compare(previous, value)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
accessor.set.call(this, value);
|
|
39
|
+
if (onChange) {
|
|
40
|
+
onChange.call(this, value, previous);
|
|
41
|
+
}
|
|
42
|
+
scheduleRender(this);
|
|
43
|
+
},
|
|
44
|
+
init(initialValue) {
|
|
45
|
+
if (transform) {
|
|
46
|
+
return transform.call(this, initialValue);
|
|
47
|
+
}
|
|
48
|
+
return initialValue;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type RenderHost = HTMLElement & {
|
|
2
|
+
requestRender?(): void;
|
|
3
|
+
render?(): void;
|
|
4
|
+
};
|
|
5
|
+
interface WatchOptions<TValue, THost extends RenderHost> {
|
|
6
|
+
compare?: (previous: TValue, next: TValue) => boolean;
|
|
7
|
+
onChange?: (this: THost, next: TValue, previous: TValue) => void;
|
|
8
|
+
transform?: (this: THost, initial: TValue) => TValue;
|
|
9
|
+
}
|
|
10
|
+
export declare function Watch<TValue, THost extends RenderHost = RenderHost>(options?: WatchOptions<TValue, THost>): (accessor: ClassAccessorDecoratorTarget<THost, TValue>, context: ClassAccessorDecoratorContext<THost, TValue>) => ClassAccessorDecoratorResult<THost, TValue>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type RenderHost = HTMLElement & {
|
|
2
|
+
requestRender?(): void;
|
|
3
|
+
render?(): void;
|
|
4
|
+
};
|
|
5
|
+
interface WatchOptions<TValue, THost extends RenderHost> {
|
|
6
|
+
compare?: (previous: TValue, next: TValue) => boolean;
|
|
7
|
+
onChange?: (this: THost, next: TValue, previous: TValue) => void;
|
|
8
|
+
transform?: (this: THost, initial: TValue) => TValue;
|
|
9
|
+
}
|
|
10
|
+
export declare function Watch<TValue, THost extends RenderHost = RenderHost>(options?: WatchOptions<TValue, THost>): (accessor: ClassAccessorDecoratorTarget<THost, TValue>, context: ClassAccessorDecoratorContext<THost, TValue>) => ClassAccessorDecoratorResult<THost, TValue>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const renderQueue = new WeakMap();
|
|
2
|
+
const scheduleRender = (instance) => {
|
|
3
|
+
if (typeof instance.requestRender === 'function') {
|
|
4
|
+
instance.requestRender();
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (typeof instance.render !== 'function') {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (renderQueue.get(instance)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
renderQueue.set(instance, true);
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
renderQueue.set(instance, false);
|
|
16
|
+
instance.render?.();
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const defaultCompare = (previous, next) => previous === next;
|
|
20
|
+
export function Watch(options = {}) {
|
|
21
|
+
const { compare = defaultCompare, onChange, transform } = options;
|
|
22
|
+
return (accessor, context) => {
|
|
23
|
+
if (context.kind !== 'accessor') {
|
|
24
|
+
throw new Error('@Watch requires the "accessor" keyword on the property.');
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
get() {
|
|
28
|
+
return accessor.get.call(this);
|
|
29
|
+
},
|
|
30
|
+
set(value) {
|
|
31
|
+
const previous = accessor.get.call(this);
|
|
32
|
+
if (compare(previous, value)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
accessor.set.call(this, value);
|
|
36
|
+
if (onChange) {
|
|
37
|
+
onChange.call(this, value, previous);
|
|
38
|
+
}
|
|
39
|
+
scheduleRender(this);
|
|
40
|
+
},
|
|
41
|
+
init(initialValue) {
|
|
42
|
+
if (transform) {
|
|
43
|
+
return transform.call(this, initialValue);
|
|
44
|
+
}
|
|
45
|
+
return initialValue;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Watch = exports.Query = exports.Prop = exports.OutsideClick = exports.Listen = exports.Component = void 0;
|
|
4
|
+
var Component_1 = require("./Component.cjs");
|
|
5
|
+
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return Component_1.Component; } });
|
|
6
|
+
var Listen_1 = require("./Listen.cjs");
|
|
7
|
+
Object.defineProperty(exports, "Listen", { enumerable: true, get: function () { return Listen_1.Listen; } });
|
|
8
|
+
var OutsideClick_1 = require("./OutsideClick.cjs");
|
|
9
|
+
Object.defineProperty(exports, "OutsideClick", { enumerable: true, get: function () { return OutsideClick_1.OutsideClick; } });
|
|
10
|
+
var Prop_1 = require("./Prop.cjs");
|
|
11
|
+
Object.defineProperty(exports, "Prop", { enumerable: true, get: function () { return Prop_1.Prop; } });
|
|
12
|
+
var Query_1 = require("./Query.cjs");
|
|
13
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_1.Query; } });
|
|
14
|
+
var Watch_1 = require("./Watch.cjs");
|
|
15
|
+
Object.defineProperty(exports, "Watch", { enumerable: true, get: function () { return Watch_1.Watch; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Component, type RenderContext } from "./Component.cjs";
|
|
2
|
+
export { Listen } from "./Listen.cjs";
|
|
3
|
+
export { OutsideClick } from "./OutsideClick.cjs";
|
|
4
|
+
export { Prop } from "./Prop.cjs";
|
|
5
|
+
export { Query } from "./Query.cjs";
|
|
6
|
+
export { Watch } from "./Watch.cjs";
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
const lit_html_1 = require("lit-html");
|
|
5
|
+
const Component_1 = require("~/decorators/Component");
|
|
6
|
+
const Prop_1 = require("~/decorators/Prop");
|
|
7
|
+
@(0, Component_1.Component)({
|
|
8
|
+
tag: 'ease-button',
|
|
9
|
+
autoSlot: true,
|
|
10
|
+
shadowMode: 'open',
|
|
11
|
+
styles: `
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([data-variant="headless"]) {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
width: auto;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
button {
|
|
23
|
+
appearance: none;
|
|
24
|
+
font-family: var(--ease-font-family, inherit);
|
|
25
|
+
font-optical-sizing: auto;
|
|
26
|
+
font-size: var(--ease-button-font-size, var(--ease-font-size-sm, 12px));
|
|
27
|
+
font-weight: 550;
|
|
28
|
+
color: var(--ease-button-color, var(--color-blue-100));
|
|
29
|
+
min-width: 0;
|
|
30
|
+
padding: var(--ease-button-padding, 7px 8px);
|
|
31
|
+
display: block;
|
|
32
|
+
border-radius: var(--ease-button-radius, 5px);
|
|
33
|
+
background-color: var(--ease-button-background, var(--color-gray-850));
|
|
34
|
+
border: none;
|
|
35
|
+
outline: none;
|
|
36
|
+
margin: 0;
|
|
37
|
+
line-height: var(--ease-button-line-height, 14px);
|
|
38
|
+
box-shadow: inset 0 1px .25px 0 var(--color-white-4), 0 1px 2.5px 0 var(--color-black-8);
|
|
39
|
+
transition: color 0.2s, background-color 0.2s, scale 0.2s, box-shadow 0.2s;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
min-width: var(--ease-button-min-width, 88px);
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
position: relative;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
text-align: center;
|
|
47
|
+
|
|
48
|
+
&[data-pill="true"] {
|
|
49
|
+
border-radius: 999px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&[data-full-width="true"] {
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[data-block="icon"] {
|
|
57
|
+
--ease-icon-size: 16px;
|
|
58
|
+
width: 28px;
|
|
59
|
+
height: 28px;
|
|
60
|
+
min-width: 28px;
|
|
61
|
+
padding: 0;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
color: var(--color-gray-700);
|
|
66
|
+
|
|
67
|
+
&:hover,
|
|
68
|
+
&:focus-visible {
|
|
69
|
+
color: var(--ease-button-hover-color, var(--color-blue-100));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&[data-variant="headless"] {
|
|
73
|
+
--ease-icon-size: 16px;
|
|
74
|
+
width: auto;
|
|
75
|
+
height: auto;
|
|
76
|
+
padding: 0;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
margin: -1px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&[data-block="small"] {
|
|
83
|
+
padding: 5px 8px;
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
line-height: 14px;
|
|
86
|
+
border-radius: 5px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-block="large"] {
|
|
90
|
+
padding: 9px 12px;
|
|
91
|
+
font-size: 13px;
|
|
92
|
+
line-height: 14px;
|
|
93
|
+
border-radius: 8px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover,
|
|
97
|
+
&:focus-visible {
|
|
98
|
+
background-color: var(--ease-button-hover-background-color, var(--color-gray-825));
|
|
99
|
+
color: var(--ease-button-hover-color, var(--color-blue-100));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&[data-variant="headless"],
|
|
103
|
+
&[data-variant="headless-muted"] {
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
box-shadow: none;
|
|
106
|
+
min-width: 0;
|
|
107
|
+
width: auto;
|
|
108
|
+
padding: 0;
|
|
109
|
+
transition: scale 0.2s, color 0.2s;
|
|
110
|
+
|
|
111
|
+
&:hover,
|
|
112
|
+
&:focus-visible {
|
|
113
|
+
scale: 1.05;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:active {
|
|
117
|
+
scale: 0.95;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&[data-variant="headless-muted"] {
|
|
122
|
+
color: var(--ease-button-color, var(--color-gray-600));
|
|
123
|
+
|
|
124
|
+
&:hover,
|
|
125
|
+
&:focus-visible {
|
|
126
|
+
color: var(--ease-button-hover-color, var(--color-blue-100));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&[data-variant="link"] {
|
|
131
|
+
background-color: transparent;
|
|
132
|
+
box-shadow: none;
|
|
133
|
+
|
|
134
|
+
&:hover,
|
|
135
|
+
&:focus-visible {
|
|
136
|
+
background-color: var(--ease-button-hover-background-color, var(--color-gray-875));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&[data-variant="primary"] {
|
|
141
|
+
color: var(--color-blue-100);
|
|
142
|
+
font-weight: 450;
|
|
143
|
+
border-radius: 36px;
|
|
144
|
+
|
|
145
|
+
background: radial-gradient(217.29% 45.98% at 99.13% 4.17%, rgba(21, 24, 220, 0.40) 0%, rgba(21, 24, 220, 0.00) 100%), radial-gradient(104.75% 41.7% at 3.06% 100%, rgba(233, 208, 254, 0.30) 0%, rgba(21, 24, 220, 0.00) 100%), radial-gradient(30.53% 47.92% at 46.51% -14.58%, rgba(233, 208, 254, 0.60) 0%, rgba(21, 24, 220, 0.00) 100%), radial-gradient(22.57% 35.42% at 46.29% 112.5%, rgba(233, 208, 254, 0.20) 0%, rgba(21, 24, 220, 0.00) 100%), rgba(255, 255, 255, 0.12);
|
|
146
|
+
background-repeat: no-repeat;
|
|
147
|
+
|
|
148
|
+
box-shadow:
|
|
149
|
+
0px 1px 0px 0px rgba(255, 255, 255, 0.2),
|
|
150
|
+
inset 0px 0px 50px 0px rgba(255, 255, 255, 0.02),
|
|
151
|
+
inset 0px 0px 0px 1px rgba(255, 255, 255, 0.02),
|
|
152
|
+
inset 0px 0px 4px 0px rgba(69, 40, 255, 0.4);
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
&::before {
|
|
156
|
+
content: '';
|
|
157
|
+
position: absolute;
|
|
158
|
+
inset: 0;
|
|
159
|
+
background-color: var(--color-white-2);
|
|
160
|
+
box-shadow: inset 0px 0.5px 0.75px 0px var(--color-white-30);
|
|
161
|
+
mix-blend-mode: overlay;
|
|
162
|
+
pointer-events: none;
|
|
163
|
+
z-index: 1;
|
|
164
|
+
border-radius: inherit;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:hover,
|
|
168
|
+
&:focus-visible {
|
|
169
|
+
filter: brightness(1.1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`
|
|
174
|
+
})
|
|
175
|
+
class Button extends HTMLElement {
|
|
176
|
+
@(0, Prop_1.Prop)({ type: Boolean, reflect: true })
|
|
177
|
+
accessor disabled = false;
|
|
178
|
+
@(0, Prop_1.Prop)({ type: Boolean, reflect: true })
|
|
179
|
+
accessor pill = false;
|
|
180
|
+
@(0, Prop_1.Prop)({ type: Boolean, reflect: true })
|
|
181
|
+
accessor fullWidth = false;
|
|
182
|
+
@(0, Prop_1.Prop)({ type: String, reflect: true, defaultValue: 'button' })
|
|
183
|
+
accessor type;
|
|
184
|
+
@(0, Prop_1.Prop)({
|
|
185
|
+
type: String,
|
|
186
|
+
reflect: true,
|
|
187
|
+
defaultValue: 'medium',
|
|
188
|
+
onAttributeChange() {
|
|
189
|
+
this.requestRender?.();
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
accessor block = 'medium';
|
|
193
|
+
@(0, Prop_1.Prop)({
|
|
194
|
+
type: String,
|
|
195
|
+
reflect: true,
|
|
196
|
+
defaultValue: 'default'
|
|
197
|
+
})
|
|
198
|
+
accessor variant;
|
|
199
|
+
render() {
|
|
200
|
+
return (0, lit_html_1.html) `
|
|
201
|
+
<button
|
|
202
|
+
type=${this.type}
|
|
203
|
+
?disabled=${this.disabled}
|
|
204
|
+
data-variant=${this.variant}
|
|
205
|
+
data-full-width=${this.fullWidth}
|
|
206
|
+
data-pill=${this.pill}
|
|
207
|
+
data-block="${this.block}"
|
|
208
|
+
>
|
|
209
|
+
<slot></slot>
|
|
210
|
+
</button>
|
|
211
|
+
`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.Button = Button;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit-html';
|
|
2
|
+
export declare class Button extends HTMLElement {
|
|
3
|
+
requestRender: () => void;
|
|
4
|
+
accessor disabled: boolean;
|
|
5
|
+
accessor pill: boolean;
|
|
6
|
+
accessor fullWidth: boolean;
|
|
7
|
+
accessor type: 'submit' | 'reset' | 'button';
|
|
8
|
+
accessor block: 'icon' | 'small' | 'medium' | 'large';
|
|
9
|
+
accessor variant: 'default' | 'primary' | 'headless' | 'headless-muted' | 'link';
|
|
10
|
+
render(): TemplateResult;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit-html';
|
|
2
|
+
export declare class Button extends HTMLElement {
|
|
3
|
+
requestRender: () => void;
|
|
4
|
+
accessor disabled: boolean;
|
|
5
|
+
accessor pill: boolean;
|
|
6
|
+
accessor fullWidth: boolean;
|
|
7
|
+
accessor type: 'submit' | 'reset' | 'button';
|
|
8
|
+
accessor block: 'icon' | 'small' | 'medium' | 'large';
|
|
9
|
+
accessor variant: 'default' | 'primary' | 'headless' | 'headless-muted' | 'link';
|
|
10
|
+
render(): TemplateResult;
|
|
11
|
+
}
|