@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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 matraic
4
+ Contact: matraic@yahoo.com
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @m3e/shape
2
+
3
+ The `m3e-shape` component allows you to use abstract shapes thoughtfully to add emphasis and decorative flair, including built-in shape morphing.
4
+
5
+ All shapes are sourced from the Material Shape library: `4-leaf-clover`, `4-sided-cookie`, `6-sided-cookie`, `7-sided-cookie`, `8-leaf-clover`, `9-sided-cookie`, `12-sided-cookie`, `arch`, `arrow`, `boom`, `bun`, `burst`, `circle`, `diamond`, `fan`, `flower`, `gem`, `ghost-ish`, `heart`, `hexagon`, `oval`, `pentagon`, `pill`, `pixel-circle`, `pixel-triangle`, `puffy`, `puffy-diamond`, `semicircle`, `slanted`, `soft-boom`, `soft-burst`, `square`, `sunny`, `triangle`, and `very-sunny`.
6
+
7
+ Refer to the Material Shape library for visual references and details.
8
+
9
+ > **Part of the [M3E](../../README.md) monorepo**
10
+ > This package is maintained within the unified M3E repository, which provides a suite of Material 3 web components.
11
+
12
+ ## 📦 Installation
13
+
14
+ ```bash
15
+ npm install @m3e/shape
16
+ ```
17
+
18
+ ## 💻 Editor Integration
19
+
20
+ This package includes a [Custom Elements Manifest](https://github.com/webcomponents/custom-elements-manifest) to support enhanced editor tooling and developer experience.
21
+
22
+ ### Visual Studio Code
23
+
24
+ To enable autocomplete and hover documentation for `@m3e/shape`, install the [Custom Elements Manifest Language Server](https://marketplace.visualstudio.com/items?itemName=pwrs.cem-language-server-vscode) extension. It will automatically detect the manifest bundled with this package and surface tag names, attributes, slots, and events in supported files.
25
+
26
+ Alternately, you can explicitly reference the `html-custom-data.json` and `css-custom-data.json` in your workspace settings:
27
+
28
+ ```json
29
+ {
30
+ "html.customData": ["./node_modules/@m3e/shape/dist/html-custom-data.json"],
31
+ "css.customData": ["./node_modules/@m3e/shape/dist/css-custom-data.json"]
32
+ }
33
+ ```
34
+
35
+ ## 🚀 Browser Usage
36
+
37
+ This package uses [JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#module_specifiers). To use it directly in a browser without a bundler, use a module script similar to the following.
38
+
39
+ ```html
40
+ <script type="module" src="/node_modules/@m3e/shape/dist/index.js"></script>
41
+ ```
42
+
43
+ In addition, you must use an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) to include dependencies.
44
+
45
+ ```html
46
+ <script type="importmap">
47
+ {
48
+ "imports": {
49
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
50
+ "@m3e/core": "/node_modules/@m3e/core/dist/index.js"
51
+ }
52
+ }
53
+ </script>
54
+ ```
55
+
56
+ > For production, use index.min.js for faster load times.
57
+
58
+ ## 🗂️ Elements
59
+
60
+ - `m3e-shape` — A shape used to add emphasis and decorative flair.
61
+
62
+ ## 🧪 Examples
63
+
64
+ The following example illustrates using the `m3e-shape` component to present the `sunny` shape.
65
+
66
+ ```html
67
+ <m3e-shape name="sunny"></m3e-shape>
68
+ ```
69
+
70
+ ## 📖 API Reference
71
+
72
+ This section details the attributes, slots and CSS custom properties available for the `m3e-shape` component.
73
+
74
+ ### ⚙️ Attributes
75
+
76
+ | Attribute | Type | Default | Description |
77
+ | --------- | ------------------- | ------- | ---------------------- |
78
+ | `name` | `ShapeName \| null` | `null` | The name of the shape. |
79
+
80
+ ### 🧩 Slots
81
+
82
+ | Slot | Description |
83
+ | ----------- | ----------------------------------------- |
84
+ | _(default)_ | Renders the clipped content of the shape. |
85
+
86
+ ### 🎛️ CSS Custom Properties
87
+
88
+ | Property | Description |
89
+ | ----------------------------- | ------------------------------------------ |
90
+ | `--m3e-shape-size` | Default size of the shape. |
91
+ | `--m3e-shape-container-color` | Container (background) color of the shape. |
92
+ | `--m3e-shape-transition` | Transition used to morph between shapes. |
93
+
94
+ ## 🤝 Contributing
95
+
96
+ See the root monorepo `CONTRIBUTING.md` for guidelines on contributing to this package.
97
+
98
+ ## 📄 License
99
+
100
+ This package is licensed under the MIT License.
package/cem.config.mjs ADDED
@@ -0,0 +1,16 @@
1
+ import { customElementVsCodePlugin } from "custom-element-vs-code-integration";
2
+
3
+ export default {
4
+ globs: ["src/**/*.ts"],
5
+ exclude: ["src/**/*.spec.ts"],
6
+ packagejson: true,
7
+ outdir: "dist",
8
+ litelement: true,
9
+ plugins: [
10
+ customElementVsCodePlugin({
11
+ outdir: "dist",
12
+ htmlFileName: "html-custom-data.json",
13
+ cssFileName: "css-custom-data.json",
14
+ }),
15
+ ],
16
+ };
@@ -0,0 +1,100 @@
1
+ <!doctype html>
2
+ <html lang="en" style="overflow-y: auto">
3
+ <head>
4
+ <title>Shape for M3E</title>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="description" content="Shape for M3E" />
8
+ <base href="./" />
9
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
10
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
+ <link
12
+ href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap"
13
+ rel="stylesheet"
14
+ />
15
+ <link
16
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0..1,0"
17
+ rel="stylesheet"
18
+ />
19
+ <script type="importmap">
20
+ {
21
+ "imports": {
22
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.0/+esm",
23
+ "@m3e/core": "../../core/dist/index.min.js"
24
+ }
25
+ }
26
+ </script>
27
+ <script type="module" src="../../theme/dist/index.min.js"></script>
28
+ <script type="module" src="../dist/index.min.js"></script>
29
+ <style>
30
+ body {
31
+ font-family: "Roboto";
32
+ }
33
+ *:not(:defined) {
34
+ display: none;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body>
39
+ <m3e-theme strong-focus>
40
+ <m3e-shape name="12-sided-cookie"></m3e-shape>
41
+ <m3e-shape name="9-sided-cookie"></m3e-shape>
42
+ <m3e-shape name="8-leaf-clover"></m3e-shape>
43
+ <m3e-shape name="7-sided-cookie"></m3e-shape>
44
+ <m3e-shape name="6-sided-cookie"></m3e-shape>
45
+ <m3e-shape name="4-sided-cookie"></m3e-shape>
46
+ <m3e-shape name="4-leaf-clover"></m3e-shape>
47
+ <br />
48
+ <m3e-shape name="arch"></m3e-shape>
49
+ <m3e-shape name="arrow"></m3e-shape>
50
+ <m3e-shape name="boom"></m3e-shape>
51
+ <m3e-shape name="bun"></m3e-shape>
52
+ <m3e-shape name="diamond"></m3e-shape>
53
+ <m3e-shape name="fan"></m3e-shape>
54
+ <m3e-shape name="flower"></m3e-shape>
55
+ <br />
56
+ <m3e-shape name="gem"></m3e-shape>
57
+ <m3e-shape name="ghost-ish"></m3e-shape>
58
+ <m3e-shape name="heart"></m3e-shape>
59
+ <m3e-shape name="hexagon"></m3e-shape>
60
+ <m3e-shape name="pentagon"></m3e-shape>
61
+ <m3e-shape name="pill"></m3e-shape>
62
+ <m3e-shape name="pixel-circle"></m3e-shape>
63
+ <br />
64
+ <m3e-shape name="pixel-triangle"></m3e-shape>
65
+ <m3e-shape name="puffy"></m3e-shape>
66
+ <m3e-shape name="puffy-diamond"></m3e-shape>
67
+ <m3e-shape name="semicircle"></m3e-shape>
68
+ <m3e-shape name="slanted"></m3e-shape>
69
+ <m3e-shape name="soft-boom"></m3e-shape>
70
+ <m3e-shape name="soft-burst"></m3e-shape>
71
+ <br />
72
+ <m3e-shape name="square"></m3e-shape>
73
+ <m3e-shape name="circle"></m3e-shape>
74
+ <m3e-shape name="triangle"></m3e-shape>
75
+ <br /><br />
76
+
77
+ <m3e-shape name="sunny" style="width: 300px">
78
+ <img src="https://www.shutterstock.com/shutterstock/videos/1006393/thumb/1.jpg?ip=x480" />
79
+ </m3e-shape>
80
+ <br /><br />
81
+ <m3e-shape name="sunny" style="width: 300px; --m3e-shape-container-color: transparent">
82
+ <video
83
+ autoplay
84
+ loop
85
+ poster="https://www.shutterstock.com/shutterstock/videos/1006393/thumb/1.jpg?ip=x480"
86
+ preload="auto"
87
+ >
88
+ <source
89
+ src="https://www.shutterstock.com/shutterstock/videos/1006393/preview/stock-footage-business-people-working-in-office.webm"
90
+ type="video/webm"
91
+ />
92
+ <source
93
+ src="https://www.shutterstock.com/shutterstock/videos/1006393/preview/stock-footage-business-people-working-in-office.mp4"
94
+ type="video/mp4"
95
+ />
96
+ </video>
97
+ </m3e-shape>
98
+ </m3e-theme>
99
+ </body>
100
+ </html>
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [
5
+ {
6
+ "name": "--m3e-shape-size",
7
+ "description": "Default size of the shape.",
8
+ "values": []
9
+ },
10
+ {
11
+ "name": "--m3e-shape-container-color",
12
+ "description": "Container (background) color of the shape.",
13
+ "values": []
14
+ },
15
+ {
16
+ "name": "--m3e-shape-transition",
17
+ "description": "Transition used to morph between shapes.",
18
+ "values": []
19
+ }
20
+ ],
21
+ "pseudoElements": []
22
+ }
@@ -0,0 +1,145 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "*",
13
+ "declaration": {
14
+ "name": "*",
15
+ "package": "\"./ShapeElement\""
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "*",
21
+ "declaration": {
22
+ "name": "*",
23
+ "package": "\"./ShapeName\""
24
+ }
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "kind": "javascript-module",
30
+ "path": "src/ShapeElement.ts",
31
+ "declarations": [
32
+ {
33
+ "kind": "class",
34
+ "description": "",
35
+ "name": "M3eShapeElement",
36
+ "cssProperties": [
37
+ {
38
+ "description": "Default size of the shape.",
39
+ "name": "--m3e-shape-size"
40
+ },
41
+ {
42
+ "description": "Container (background) color of the shape.",
43
+ "name": "--m3e-shape-container-color"
44
+ },
45
+ {
46
+ "description": "Transition used to morph between shapes.",
47
+ "name": "--m3e-shape-transition"
48
+ }
49
+ ],
50
+ "slots": [
51
+ {
52
+ "description": "Renders the clipped content of the shape.",
53
+ "name": ""
54
+ }
55
+ ],
56
+ "members": [
57
+ {
58
+ "kind": "field",
59
+ "name": "name",
60
+ "type": {
61
+ "text": "ShapeName | null"
62
+ },
63
+ "default": "null",
64
+ "description": "The name of the shape.",
65
+ "attribute": "name",
66
+ "reflects": true
67
+ }
68
+ ],
69
+ "attributes": [
70
+ {
71
+ "description": "The name of the shape.",
72
+ "name": "name",
73
+ "type": {
74
+ "text": "ShapeName | null"
75
+ },
76
+ "default": "null",
77
+ "fieldName": "name"
78
+ }
79
+ ],
80
+ "mixins": [
81
+ {
82
+ "name": "Role",
83
+ "package": "@m3e/core"
84
+ }
85
+ ],
86
+ "superclass": {
87
+ "name": "LitElement",
88
+ "package": "lit"
89
+ },
90
+ "tagName": "m3e-shape",
91
+ "customElement": true,
92
+ "summary": "A shape used to add emphasis and decorative flair."
93
+ }
94
+ ],
95
+ "exports": [
96
+ {
97
+ "kind": "js",
98
+ "name": "M3eShapeElement",
99
+ "declaration": {
100
+ "name": "M3eShapeElement",
101
+ "module": "src/ShapeElement.ts"
102
+ }
103
+ },
104
+ {
105
+ "kind": "custom-element-definition",
106
+ "name": "m3e-shape",
107
+ "declaration": {
108
+ "name": "M3eShapeElement",
109
+ "module": "src/ShapeElement.ts"
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "kind": "javascript-module",
116
+ "path": "src/ShapeName.ts",
117
+ "declarations": [],
118
+ "exports": []
119
+ },
120
+ {
121
+ "kind": "javascript-module",
122
+ "path": "src/ShapeNameStyle.ts",
123
+ "declarations": [],
124
+ "exports": []
125
+ },
126
+ {
127
+ "kind": "javascript-module",
128
+ "path": "src/ShapePolygon.ts",
129
+ "declarations": [],
130
+ "exports": []
131
+ },
132
+ {
133
+ "kind": "javascript-module",
134
+ "path": "src/ShapeStyle.ts",
135
+ "declarations": [],
136
+ "exports": []
137
+ },
138
+ {
139
+ "kind": "javascript-module",
140
+ "path": "src/ShapeToken.ts",
141
+ "declarations": [],
142
+ "exports": []
143
+ }
144
+ ]
145
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "m3e-shape",
7
+ "description": "A shape used to add emphasis and decorative flair.\n---\n\n\n### **Slots:**\n - _default_ - Renders the clipped content of the shape.\n\n### **CSS Properties:**\n - **--m3e-shape-size** - Default size of the shape. _(default: undefined)_\n- **--m3e-shape-container-color** - Container (background) color of the shape. _(default: undefined)_\n- **--m3e-shape-transition** - Transition used to morph between shapes. _(default: undefined)_",
8
+ "attributes": [
9
+ {
10
+ "name": "name",
11
+ "description": "The name of the shape.",
12
+ "values": [{ "name": "ShapeName" }]
13
+ }
14
+ ],
15
+ "references": []
16
+ }
17
+ ]
18
+ }