sacred-geometry-generator 1.0.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/sg.css ADDED
@@ -0,0 +1,295 @@
1
+ :root {
2
+ --bg: #12122a;
3
+ --bg2: #1c1b3a;
4
+ --ink: #ece7dc;
5
+ --muted: #9d97be;
6
+ --accent: #d4af37;
7
+ --accent2: #ffd77a;
8
+ --line: #ffffff1f;
9
+ }
10
+ * {
11
+ box-sizing: border-box;
12
+ }
13
+ html {
14
+ color: var(--ink);
15
+ background: var(--bg)
16
+ radial-gradient(circle at 50% 0%, #2a2456 0%, #12122a 55%, #0b0b18 100%)
17
+ fixed;
18
+ scroll-behavior: smooth;
19
+ min-height: 100%;
20
+ }
21
+ html,
22
+ button,
23
+ select,
24
+ input {
25
+ font-family: "Marcellus", Georgia, serif;
26
+ font-size: 16px;
27
+ }
28
+ body {
29
+ margin: 0;
30
+ padding: 0 0 40px;
31
+ }
32
+ h1,
33
+ h2,
34
+ h3 {
35
+ font-weight: normal;
36
+ margin: 0;
37
+ }
38
+ a {
39
+ color: var(--muted);
40
+ transition: color 0.4s;
41
+ }
42
+ a:hover {
43
+ color: var(--accent2);
44
+ }
45
+
46
+ #header {
47
+ position: sticky;
48
+ top: 0;
49
+ z-index: 100;
50
+ padding: 12px 20px 8px;
51
+ background: #12122ae6;
52
+ backdrop-filter: blur(8px);
53
+ border-bottom: 1px solid var(--line);
54
+ }
55
+ #header h1 {
56
+ display: inline-block;
57
+ font-size: 22px;
58
+ letter-spacing: 0.04em;
59
+ margin-right: 20px;
60
+ }
61
+ #header h1 > span {
62
+ color: var(--accent);
63
+ }
64
+ #header .links {
65
+ float: right;
66
+ padding-top: 6px;
67
+ font-size: 14px;
68
+ }
69
+ #header .links > a {
70
+ margin-left: 16px;
71
+ text-decoration: none;
72
+ }
73
+ .nav {
74
+ margin-top: 8px;
75
+ white-space: nowrap;
76
+ overflow-x: auto;
77
+ }
78
+ .nav > a {
79
+ display: inline-block;
80
+ margin-right: 6px;
81
+ padding: 4px 12px;
82
+ border: 1px solid var(--line);
83
+ border-radius: 20px;
84
+ color: var(--muted);
85
+ text-decoration: none;
86
+ transition:
87
+ color 0.3s,
88
+ border-color 0.3s,
89
+ background 0.3s;
90
+ }
91
+ .nav > a:hover {
92
+ color: var(--accent2);
93
+ border-color: #ffd77a66;
94
+ }
95
+ .nav > a.on {
96
+ color: #12122a;
97
+ background: var(--accent);
98
+ border-color: var(--accent);
99
+ }
100
+
101
+ main {
102
+ display: grid;
103
+ grid-template-columns: 1fr 300px;
104
+ gap: 24px;
105
+ max-width: 1180px;
106
+ margin: 24px auto;
107
+ padding: 0 20px;
108
+ }
109
+
110
+ .stage {
111
+ border: 1px solid var(--line);
112
+ border-radius: 10px;
113
+ overflow: hidden;
114
+ background: #00000026;
115
+ aspect-ratio: 1;
116
+ display: flex;
117
+ }
118
+ .stage > svg {
119
+ width: 100%;
120
+ height: 100%;
121
+ display: block;
122
+ }
123
+
124
+ .panel > h2 {
125
+ font-size: 25px;
126
+ color: var(--accent2);
127
+ }
128
+ .panel > .tagline {
129
+ color: var(--muted);
130
+ font-style: italic;
131
+ margin: 2px 0 12px;
132
+ }
133
+ .panel > .blurb {
134
+ color: var(--muted);
135
+ line-height: 1.55;
136
+ font-size: 14px;
137
+ margin: 0 0 22px;
138
+ }
139
+ .panel label {
140
+ display: block;
141
+ margin-bottom: 14px;
142
+ font-size: 14px;
143
+ color: var(--muted);
144
+ }
145
+ .panel label > span {
146
+ display: block;
147
+ margin-bottom: 4px;
148
+ }
149
+ .panel label b {
150
+ color: var(--accent2);
151
+ font-weight: normal;
152
+ }
153
+ .panel label.check {
154
+ cursor: pointer;
155
+ }
156
+ .panel label.check > input {
157
+ margin-right: 8px;
158
+ accent-color: var(--accent);
159
+ vertical-align: -2px;
160
+ }
161
+ input[type="range"] {
162
+ width: 100%;
163
+ accent-color: var(--accent);
164
+ cursor: pointer;
165
+ }
166
+ select {
167
+ width: 100%;
168
+ padding: 6px 8px;
169
+ color: var(--ink);
170
+ background: var(--bg2);
171
+ border: 1px solid var(--line);
172
+ border-radius: 6px;
173
+ }
174
+ .buttons {
175
+ display: flex;
176
+ flex-wrap: wrap;
177
+ gap: 8px;
178
+ margin-top: 22px;
179
+ }
180
+ button {
181
+ flex: 1;
182
+ min-width: 84px;
183
+ padding: 9px 10px;
184
+ color: var(--ink);
185
+ background: #ffffff0f;
186
+ border: 1px solid var(--line);
187
+ border-radius: 6px;
188
+ cursor: pointer;
189
+ transition:
190
+ background 0.3s,
191
+ color 0.3s,
192
+ border-color 0.3s;
193
+ }
194
+ button:hover {
195
+ color: var(--accent2);
196
+ border-color: #ffd77a66;
197
+ background: #ffffff1a;
198
+ }
199
+ .hint {
200
+ margin-top: 14px;
201
+ font-size: 12px;
202
+ color: #7d78a0;
203
+ min-height: 16px;
204
+ }
205
+
206
+ /* --- gallery --- */
207
+ .cards {
208
+ display: grid;
209
+ grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
210
+ gap: 20px;
211
+ max-width: 1180px;
212
+ margin: 24px auto;
213
+ padding: 0 20px;
214
+ }
215
+ .card {
216
+ display: block;
217
+ padding: 14px;
218
+ border: 1px solid var(--line);
219
+ border-radius: 10px;
220
+ background: #00000026;
221
+ color: var(--ink);
222
+ text-decoration: none;
223
+ transition:
224
+ border-color 0.4s,
225
+ transform 0.4s;
226
+ }
227
+ .card:hover {
228
+ border-color: #ffd77a66;
229
+ transform: translateY(-3px);
230
+ color: var(--ink);
231
+ }
232
+ .card > svg {
233
+ width: 100%;
234
+ display: block;
235
+ }
236
+ .card > h2 {
237
+ font-size: 18px;
238
+ color: var(--accent2);
239
+ margin-top: 10px;
240
+ }
241
+ .card > p {
242
+ margin: 4px 0 0;
243
+ font-size: 13px;
244
+ color: var(--muted);
245
+ font-style: italic;
246
+ }
247
+ .intro {
248
+ max-width: 1180px;
249
+ margin: 24px auto 0;
250
+ padding: 0 20px;
251
+ color: var(--muted);
252
+ line-height: 1.6;
253
+ }
254
+
255
+ /* --- drawing animation --- */
256
+ .anim [data-len] {
257
+ stroke-dasharray: var(--len, 100);
258
+ stroke-dashoffset: var(--len, 100);
259
+ animation: draw 0.9s ease-out forwards;
260
+ }
261
+ @keyframes draw {
262
+ to {
263
+ stroke-dashoffset: 0;
264
+ }
265
+ }
266
+
267
+ .footer {
268
+ max-width: 1180px;
269
+ margin: 40px auto 0;
270
+ padding: 20px;
271
+ border-top: 1px solid var(--line);
272
+ color: var(--muted);
273
+ font-size: 14px;
274
+ line-height: 1.7;
275
+ }
276
+ .footer a {
277
+ color: var(--accent2);
278
+ }
279
+
280
+ @media only screen and (max-width: 860px) {
281
+ main {
282
+ grid-template-columns: 1fr;
283
+ }
284
+ #header h1 {
285
+ font-size: 19px;
286
+ }
287
+ #header .links {
288
+ float: none;
289
+ display: block;
290
+ padding: 4px 0 0;
291
+ }
292
+ #header .links > a {
293
+ margin: 0 16px 0 0;
294
+ }
295
+ }
package/sw.js ADDED
@@ -0,0 +1,66 @@
1
+ const CACHE = "sg-v1";
2
+ const ASSETS = [
3
+ "./",
4
+ "index.html",
5
+ "gallery.html",
6
+ "sg.css",
7
+ "patterns.js",
8
+ "js/sg.js",
9
+ "favicon.png",
10
+ "icon-192.png",
11
+ "icon-512.png",
12
+ "manifest.json",
13
+ ];
14
+
15
+ self.addEventListener("install", (e) => {
16
+ // "reload" bypasses the HTTP cache, so an update never caches stale files
17
+ e.waitUntil(
18
+ caches
19
+ .open(CACHE)
20
+ .then((c) =>
21
+ c.addAll(ASSETS.map((u) => new Request(u, { cache: "reload" }))),
22
+ ),
23
+ );
24
+ self.skipWaiting();
25
+ });
26
+
27
+ self.addEventListener("activate", (e) => {
28
+ e.waitUntil(
29
+ caches
30
+ .keys()
31
+ .then((keys) =>
32
+ Promise.all(
33
+ keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)),
34
+ ),
35
+ ),
36
+ );
37
+ self.clients.claim();
38
+ });
39
+
40
+ self.addEventListener("fetch", (e) => {
41
+ const url = new URL(e.request.url);
42
+ const cacheable =
43
+ url.origin === location.origin ||
44
+ url.hostname === "fonts.googleapis.com" ||
45
+ url.hostname === "fonts.gstatic.com";
46
+ if (e.request.method !== "GET" || !cacheable) return;
47
+ e.respondWith(
48
+ caches.match(e.request).then(
49
+ (cached) =>
50
+ cached ||
51
+ fetch(e.request)
52
+ .then((res) => {
53
+ if (res.ok) {
54
+ const copy = res.clone();
55
+ caches.open(CACHE).then((c) => c.put(e.request, copy));
56
+ }
57
+ return res;
58
+ })
59
+ .catch(() =>
60
+ e.request.mode === "navigate"
61
+ ? caches.match("index.html")
62
+ : undefined,
63
+ ),
64
+ ),
65
+ );
66
+ });