engramma 0.0.0 → 0.1.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 +21 -0
- package/README.md +106 -0
- package/dist/engramma.js +20958 -0
- package/package.json +17 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bogdan Chadkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Engramma Web Component
|
|
2
|
+
|
|
3
|
+
An embeddable web component for previewing and editing CSS variables as design tokens.
|
|
4
|
+
Perfect for developers building design systems who want an easy way to test and refine their variables.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
### From unpkg (simplest)
|
|
9
|
+
|
|
10
|
+
```html
|
|
11
|
+
<script
|
|
12
|
+
type="module"
|
|
13
|
+
src="https://unpkg.com/engramma@latest/dist/engramma.js"
|
|
14
|
+
></script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### From npm
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install engramma
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then import in your module:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import "engramma";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Integration
|
|
30
|
+
|
|
31
|
+
Add the web component to any HTML page using a dialog to avoid affecting your page layout:
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<!DOCTYPE html>
|
|
35
|
+
<html>
|
|
36
|
+
<head>
|
|
37
|
+
<style>
|
|
38
|
+
:root {
|
|
39
|
+
--color-primary: #3b82f6;
|
|
40
|
+
--color-secondary: #10b981;
|
|
41
|
+
--spacing-unit: 8px;
|
|
42
|
+
--font-size-base: 16px;
|
|
43
|
+
}
|
|
44
|
+
body {
|
|
45
|
+
color: var(--color-secondary);
|
|
46
|
+
font-size: var(--font-size-base);
|
|
47
|
+
display: grid;
|
|
48
|
+
gap: var(--spacing-unit);
|
|
49
|
+
}
|
|
50
|
+
h1 {
|
|
51
|
+
color: var(--color-primary);
|
|
52
|
+
}
|
|
53
|
+
#engramma-dialog:modal {
|
|
54
|
+
top: 8px;
|
|
55
|
+
right: 8px;
|
|
56
|
+
bottom: auto;
|
|
57
|
+
left: auto;
|
|
58
|
+
width: 30dvw;
|
|
59
|
+
height: calc(100dvh - 16px);
|
|
60
|
+
padding: 0;
|
|
61
|
+
border: 0;
|
|
62
|
+
box-shadow: 0 0 10px rgb(0 0 0 / 30%);
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<h1>My App</h1>
|
|
68
|
+
<p>Edit the CSS variables with Engramma</p>
|
|
69
|
+
|
|
70
|
+
<script
|
|
71
|
+
type="module"
|
|
72
|
+
src="https://unpkg.com/engramma@latest/dist/engramma.js"
|
|
73
|
+
></script>
|
|
74
|
+
|
|
75
|
+
<button commandfor="engramma-dialog" command="show-modal">
|
|
76
|
+
Edit design tokens
|
|
77
|
+
</button>
|
|
78
|
+
|
|
79
|
+
<dialog id="engramma-dialog" closedby="any">
|
|
80
|
+
<engramma-app></engramma-app>
|
|
81
|
+
</dialog>
|
|
82
|
+
</body>
|
|
83
|
+
</html>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## How CSS Variables Are Handled
|
|
87
|
+
|
|
88
|
+
When the component loads, it:
|
|
89
|
+
|
|
90
|
+
1. Looks for all CSS custom properties (`--variable-name`) in HTML element (or :root selector)
|
|
91
|
+
2. Detects types:
|
|
92
|
+
- Colors (hex, rgb, hsl, named)
|
|
93
|
+
- Dimensions (px, rem, em, etc.)
|
|
94
|
+
- Font sizes, weights, families
|
|
95
|
+
- Durations, bezier curves, and more
|
|
96
|
+
3. **Structures them** as design tokens following DTCG (Design Tokens Community Group) format
|
|
97
|
+
4. Whenever you change any token it is automatically converted to css custom properties and written back to :root
|
|
98
|
+
|
|
99
|
+
## Use Cases
|
|
100
|
+
|
|
101
|
+
- **Design System Preview**: Load your CSS variables and see them as organized design tokens
|
|
102
|
+
- **Variable Experimentation**: Tweak values in real-time while designing
|
|
103
|
+
- **Token Extraction**: Convert existing CSS variables into a structured design token system
|
|
104
|
+
- **Component Library Testing**: Test color schemes, spacing, and typography across components
|
|
105
|
+
|
|
106
|
+
For the standalone editor experience, visit [engramma.dev](https://app.engramma.dev).
|