@m3e/shape 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ import { css, CSSResultGroup } from "lit";
2
+
3
+ import { ShapeToken } from "./ShapeToken";
4
+
5
+ /**
6
+ * Baseline styles for `M3eShapeElement`.
7
+ * @internal
8
+ */
9
+ export const ShapeStyle: CSSResultGroup = css`
10
+ :host {
11
+ display: inline-block;
12
+ position: relative;
13
+ aspect-ratio: 1 / 1;
14
+ width: ${ShapeToken.size};
15
+ }
16
+ :host([name]) .wrapper {
17
+ background-color: ${ShapeToken.containerColor};
18
+ transition: ${ShapeToken.transition};
19
+ transform-origin: center;
20
+ }
21
+ .wrapper {
22
+ width: 100%;
23
+ height: 100%;
24
+ position: relative;
25
+ isolation: isolate;
26
+ overflow: hidden;
27
+ }
28
+ ::slotted(img),
29
+ ::slotted(video) {
30
+ position: absolute;
31
+ inset: 0;
32
+ width: 100%;
33
+ height: 100%;
34
+ object-fit: cover;
35
+ }
36
+ @media (prefers-reduced-motion) {
37
+ .wrapper {
38
+ transition: none;
39
+ }
40
+ }
41
+ `;
@@ -0,0 +1,18 @@
1
+ import { unsafeCSS } from "lit";
2
+
3
+ import { DesignToken } from "@m3e/core";
4
+
5
+ /**
6
+ * Component design tokens that control the `M3eShapeElement` for all variants.
7
+ * @internal
8
+ */
9
+ export const ShapeToken = {
10
+ /** Default size of the shape. */
11
+ size: unsafeCSS(`var(--m3e-shape-size, 3rem)`),
12
+
13
+ /** Container (background) color of the shape. */
14
+ containerColor: unsafeCSS(`var(--m3e-shape-container-color, ${DesignToken.color.primary})`),
15
+
16
+ /** Transition used to morph between shapes. */
17
+ transition: unsafeCSS(`var(--m3e-shape-transition, clip-path ${DesignToken.motion.spring.slowEffects})`),
18
+ } as const;
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./ShapeElement";
2
+ export * from "./ShapeName";
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./dist/src"
6
+ },
7
+ "include": ["src/**/*.ts", "**/*.mjs", "**/*.js"],
8
+ "exclude": []
9
+ }