typography-controller 1.0.1 → 1.0.3

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/dist/index.html DELETED
@@ -1,196 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <title>Typography Controller Demo</title>
7
-
8
- <style>
9
- body {
10
- margin: 0;
11
- min-height: 100vh;
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
- background: linear-gradient(135deg, #dbeafe, #eff6ff);
16
- color: #1e293b;
17
- font-family: system-ui, sans-serif;
18
- }
19
-
20
- .page-layout {
21
- display: grid;
22
- grid-template-columns: 1fr 420px;
23
- gap: 32px;
24
- padding: 40px;
25
- min-height: 100vh;
26
- box-sizing: border-box;
27
- }
28
-
29
- /* LEFT PANEL */
30
- .left-panel {
31
- display: flex;
32
- align-items: top;
33
- justify-content: center;
34
- }
35
-
36
- .preview {
37
- padding: 28px 32px;
38
- border-radius: 18px;
39
- background: rgba(255, 255, 255, 0.7);
40
- backdrop-filter: blur(12px);
41
- box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
42
- max-width: 600px;
43
- }
44
-
45
- #demoText {
46
- margin: 0;
47
- color: #0f172a;
48
- font-size: 32px;
49
- line-height: 1.4;
50
- }
51
-
52
- /* RIGHT PANEL */
53
- .right-panel {
54
- display: grid;
55
- grid-template-rows: auto 1fr;
56
- gap: 20px;
57
- position: fixed;
58
- right:0;
59
- }
60
-
61
- /* TOGGLE CHIPS */
62
- .feature-toggles {
63
- padding: 16px;
64
- border-radius: 16px;
65
- background: rgba(255, 255, 255, 0.65);
66
- backdrop-filter: blur(10px);
67
- border: 1px solid rgba(0, 0, 0, 0.08);
68
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
69
- display: flex;
70
- flex-wrap: wrap;
71
- gap: 10px;
72
- }
73
-
74
- .toggle-title {
75
- width: 100%;
76
- font-size: 13px;
77
- font-weight: 600;
78
- color: #475569;
79
- margin-bottom: 4px;
80
- }
81
-
82
- .chip {
83
- padding: 8px 14px;
84
- border-radius: 20px;
85
- font-size: 13px;
86
- cursor: pointer;
87
- user-select: none;
88
- background: #e2e8f0;
89
- color: #1e293b;
90
- border: 1px solid #cbd5e1;
91
- transition: all 0.2s ease;
92
- }
93
-
94
- .chip.active {
95
- background: #3b82f6;
96
- color: white;
97
- border-color: #2563eb;
98
- box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
99
- }
100
-
101
- /* CONTROLLER */
102
- .controller-wrapper {
103
- padding: 0;
104
- display: flex;
105
- align-items: flex-start;
106
- }
107
-
108
-
109
- @media (max-width: 800px) {
110
- .layout {
111
- grid-template-columns: 1fr;
112
- }
113
- }
114
- </style>
115
- </head>
116
-
117
- <body>
118
- <div class="page-layout">
119
-
120
- <!-- LEFT SIDE: TEXT PREVIEW -->
121
- <div class="left-panel">
122
- <div class="preview">
123
- <h2 id="demoText">
124
- Typography should feel like breathing space, not noise.
125
- </h2>
126
- </div>
127
- </div>
128
-
129
- <!-- RIGHT SIDE: TOGGLES + CONTROLLER -->
130
- <div class="right-panel">
131
-
132
- <!-- TOP: FEATURE TOGGLE CHIPS -->
133
- <div class="feature-toggles">
134
- <div class="toggle-title">Toggle Features</div>
135
- <div class="chip" id="chipLetter">Letter Spacing</div>
136
- <div class="chip" id="chipWord">Word Spacing</div>
137
- <div class="chip" id="chipLine">Line Height</div>
138
- <div class="chip" id="chipContrast">Contrast</div>
139
- </div>
140
-
141
- <!-- BOTTOM: TYPOGRAPHY CONTROLLER -->
142
- <div class="controller-wrapper">
143
- <typography-controller target="#demoText"></typography-controller>
144
-
145
- </div>
146
-
147
- </div>
148
- </div>
149
- <script>
150
- customElements.whenDefined("typography-controller").then(() => {
151
- const controller = document.querySelector("typography-controller");
152
-
153
- const chips = {
154
- letterSpacing: document.getElementById("chipLetter"),
155
- wordSpacing: document.getElementById("chipWord"),
156
- lineHeight: document.getElementById("chipLine"),
157
- contrast: document.getElementById("chipContrast")
158
- };
159
-
160
- const state = {
161
- letterSpacing: true,
162
- wordSpacing: true,
163
- lineHeight: true,
164
- contrast: true
165
- };
166
-
167
- controller.setFeatures(state);
168
-
169
- function toggleFeature(key) {
170
- state[key] = !state[key];
171
- controller.setFeatures({ [key]: state[key] });
172
-
173
- if (state[key]) chips[key].classList.add("active");
174
- else chips[key].classList.remove("active");
175
- }
176
-
177
- chips.letterSpacing.onclick = () => toggleFeature("letterSpacing");
178
- chips.wordSpacing.onclick = () => toggleFeature("wordSpacing");
179
- chips.lineHeight.onclick = () => toggleFeature("lineHeight");
180
- chips.contrast.onclick = () => toggleFeature("contrast");
181
-
182
- // Initialize chips visually
183
- Object.keys(state).forEach(key => {
184
- if (state[key]) chips[key].classList.add("active");
185
- else chips[key].classList.remove("active");
186
- });
187
- });
188
- </script>
189
-
190
-
191
- <script type="module" src="./typography-controller.js"></script>
192
-
193
-
194
- </body>
195
-
196
- </html>