codepen-demokit 1.0.0 → 1.1.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/shell/styles.css CHANGED
@@ -1,5 +1,35 @@
1
1
  @layer reset, base, components;
2
2
 
3
+ @property --path-fade-start {
4
+ syntax: "<length>";
5
+ inherits: false;
6
+ initial-value: 0px;
7
+ }
8
+
9
+ @property --path-fade-end {
10
+ syntax: "<length>";
11
+ inherits: false;
12
+ initial-value: 0px;
13
+ }
14
+
15
+ @keyframes demo-path-fade {
16
+ 0% {
17
+ --path-fade-start: 2.25rem;
18
+ --path-fade-end: 0px;
19
+ }
20
+
21
+ 1%,
22
+ 99% {
23
+ --path-fade-start: 2.25rem;
24
+ --path-fade-end: 2.25rem;
25
+ }
26
+
27
+ 100% {
28
+ --path-fade-start: 0px;
29
+ --path-fade-end: 2.25rem;
30
+ }
31
+ }
32
+
3
33
  :root {
4
34
  color-scheme: light dark;
5
35
 
@@ -15,12 +45,16 @@
15
45
  --text-primary-dark: oklch(94% 0.008 250);
16
46
  --text-muted-light: oklch(46% 0.016 260);
17
47
  --text-muted-dark: oklch(72% 0.014 255);
48
+ --text-subtle-light: oklch(56% 0.014 260);
49
+ --text-subtle-dark: oklch(62% 0.014 255);
18
50
 
19
51
  --border-subtle-light: oklch(88% 0.01 255);
20
52
  --border-subtle-dark: oklch(30% 0.018 260);
21
53
 
22
54
  --accent-light: oklch(48% 0.2 260);
23
55
  --accent-dark: oklch(75% 0.15 250);
56
+ --accent-fg-light: oklch(99% 0 0);
57
+ --accent-fg-dark: oklch(15% 0.015 260);
24
58
 
25
59
  /* Tier 2: Semantic tokens */
26
60
  --surface-page: light-dark(var(--surface-page-light), var(--surface-page-dark));
@@ -29,9 +63,11 @@
29
63
 
30
64
  --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
31
65
  --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
66
+ --text-subtle: light-dark(var(--text-subtle-light), var(--text-subtle-dark));
32
67
 
33
68
  --border-subtle: light-dark(var(--border-subtle-light), var(--border-subtle-dark));
34
69
  --accent: light-dark(var(--accent-light), var(--accent-dark));
70
+ --accent-fg: light-dark(var(--accent-fg-light), var(--accent-fg-dark));
35
71
 
36
72
  --radius-card: 0.875rem;
37
73
  --radius-code: 0.375rem;
@@ -181,7 +217,7 @@
181
217
 
182
218
  .demo-grid {
183
219
  display: grid;
184
- grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
220
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
185
221
  gap: 1rem;
186
222
  list-style: none;
187
223
  margin: 0;
@@ -190,77 +226,203 @@
190
226
 
191
227
  .demo-card {
192
228
  position: relative;
193
- grid-row: span 3;
229
+ grid-row: span 4;
194
230
  display: grid;
195
231
  /* Same-cascade fallback when subgrid is unsupported */
196
- grid-template-rows: auto 1fr auto;
232
+ grid-template-rows: auto auto 1fr auto;
197
233
  grid-template-rows: subgrid;
198
- row-gap: 0.5rem;
199
- padding: 1.25rem;
234
+ row-gap: 0.45rem;
235
+ padding: 1.15rem 1.25rem;
200
236
  background-color: var(--surface-card);
201
237
  border: 1px solid var(--border-subtle);
202
238
  border-radius: var(--radius-card);
203
239
  corner-shape: squircle;
204
240
  transition: border-color 150ms ease, translate 150ms ease;
205
241
 
206
- &:hover {
242
+ &:hover:not(:has(.demo-btn-secondary:hover)) {
207
243
  border-color: var(--accent);
208
244
  translate: 0 -2px;
209
- }
210
245
 
211
- & .demo-card-title {
212
- grid-row: 1;
213
- font-size: 1.05rem;
214
-
215
- & a {
216
- text-decoration: none;
246
+ & .demo-card-title {
247
+ color: var(--accent);
248
+ }
217
249
 
218
- &::after {
219
- content: "";
220
- position: absolute;
221
- inset: 0;
222
- }
250
+ & .demo-btn-primary {
251
+ background-color: color-mix(in oklch, var(--accent) 88%, var(--text-primary));
223
252
  }
224
253
  }
225
254
 
226
- & p {
227
- grid-row: 2;
228
- color: var(--text-muted);
229
- font-size: 0.9375rem;
255
+ &:has(.demo-btn-primary:focus-visible) {
256
+ border-color: var(--accent);
230
257
  }
231
258
  }
232
259
 
233
- .demo-meta {
260
+ .demo-path {
261
+ grid-row: 1;
262
+ position: relative;
263
+ z-index: 1;
264
+ display: flex;
265
+ flex-direction: row-reverse;
266
+ min-inline-size: 0;
267
+ overflow-x: auto;
268
+ overscroll-behavior-x: contain;
269
+ scrollbar-width: none;
270
+ -webkit-mask-image: linear-gradient(
271
+ to right,
272
+ transparent 0,
273
+ black var(--path-fade-start),
274
+ black calc(100% - var(--path-fade-end)),
275
+ transparent 100%
276
+ );
277
+ mask-image: linear-gradient(
278
+ to right,
279
+ transparent 0,
280
+ black var(--path-fade-start),
281
+ black calc(100% - var(--path-fade-end)),
282
+ transparent 100%
283
+ );
284
+ animation: demo-path-fade linear both;
285
+ animation-timeline: scroll(self inline);
286
+
287
+ &::-webkit-scrollbar {
288
+ display: none;
289
+ }
290
+
291
+ &[data-overflows] {
292
+ --path-fade-start: 2.25rem;
293
+ }
294
+ }
295
+
296
+ .demo-path-text {
297
+ flex-shrink: 0;
298
+ margin-inline-end: auto;
299
+ white-space: nowrap;
300
+ padding: 0;
301
+ border-radius: 0;
302
+ background: none;
303
+ font-size: 0.75rem;
304
+ line-height: 1.35;
305
+ color: var(--text-subtle);
306
+ }
307
+
308
+ .demo-card-title {
309
+ grid-row: 2;
310
+ font-size: 1.05rem;
311
+ line-height: 1.3;
312
+ transition: color 150ms ease;
313
+ }
314
+
315
+ .demo-body {
234
316
  grid-row: 3;
317
+ display: grid;
318
+ align-content: start;
319
+ gap: 0.65rem;
320
+ min-inline-size: 0;
321
+ }
322
+
323
+ .demo-description {
324
+ color: var(--text-muted);
325
+ font-size: 0.9rem;
326
+ line-height: 1.5;
327
+ }
328
+
329
+ .demo-tags {
235
330
  display: flex;
236
331
  flex-wrap: wrap;
237
- align-items: start;
332
+ gap: 0.35rem;
333
+ list-style: none;
334
+ margin: 0;
335
+ padding: 0;
336
+ }
337
+
338
+ .demo-tag {
339
+ font-size: 0.75rem;
340
+ line-height: 1.2;
341
+ padding-block: 0.2em;
342
+ padding-inline: 0.6em;
343
+ border-radius: 999px;
344
+ background-color: var(--surface-code);
345
+ color: var(--text-muted);
346
+ }
347
+
348
+ .demo-footer {
349
+ grid-row: 4;
350
+ display: flex;
351
+ flex-wrap: wrap;
352
+ align-items: center;
238
353
  justify-content: space-between;
239
354
  gap: 0.5rem;
355
+ padding-block-start: 0.75rem;
356
+ margin-block-start: 0.35rem;
357
+ border-block-start: 1px solid color-mix(in oklch, var(--border-subtle) 70%, transparent);
240
358
  }
241
359
 
242
- .demo-description + .demo-meta {
243
- margin-block-start: 0.25rem;
360
+ .demo-btn {
361
+ display: inline-flex;
362
+ align-items: center;
363
+ justify-content: center;
364
+ gap: 0.38em;
365
+ padding-block: 0.36em;
366
+ padding-inline: 0.75em;
367
+ border-radius: var(--radius-code);
368
+ border: 1px solid transparent;
369
+ font-size: 0.8rem;
370
+ font-weight: 500;
371
+ line-height: 1.3;
372
+ text-decoration: none;
373
+ white-space: nowrap;
374
+ transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
244
375
  }
245
376
 
246
- .demo-path {
247
- min-inline-size: 0;
248
- overflow-wrap: anywhere;
377
+ .demo-btn-primary {
378
+ background-color: var(--accent);
379
+ color: var(--accent-fg);
380
+
381
+ &::after {
382
+ content: "";
383
+ position: absolute;
384
+ inset: 0;
385
+ }
386
+
387
+ &:hover {
388
+ background-color: color-mix(in oklch, var(--accent) 88%, var(--text-primary));
389
+ }
249
390
  }
250
391
 
251
- .demo-codepen {
392
+ .demo-btn-secondary {
252
393
  position: relative;
253
394
  z-index: 1;
254
- flex-shrink: 0;
255
- font-size: 0.8125rem;
256
- font-weight: 500;
257
- text-decoration: none;
395
+ border-color: var(--border-subtle);
396
+ background-color: var(--surface-page);
397
+ color: var(--text-primary);
258
398
 
259
- &:hover {
260
- text-decoration: underline;
399
+ &:hover:not([aria-disabled="true"]) {
400
+ border-color: color-mix(in oklch, var(--accent) 60%, var(--border-subtle));
401
+ color: var(--accent);
402
+ }
403
+
404
+ &[aria-disabled="true"] {
405
+ opacity: 0.45;
406
+ color: var(--text-muted);
407
+ background-color: transparent;
408
+ cursor: not-allowed;
261
409
  }
262
410
  }
263
411
 
412
+ .demo-btn-icon {
413
+ flex-shrink: 0;
414
+ }
415
+
416
+ .demo-open-icon {
417
+ inline-size: 0.8125rem;
418
+ block-size: 0.8125rem;
419
+ }
420
+
421
+ .demo-codepen-icon {
422
+ inline-size: 0.75rem;
423
+ block-size: 0.75rem;
424
+ }
425
+
264
426
  .empty-state {
265
427
  display: grid;
266
428
  gap: 0.75rem;
@@ -288,12 +450,14 @@
288
450
  }
289
451
 
290
452
  @media (prefers-reduced-motion: reduce) {
291
- .demo-card {
453
+ .demo-card,
454
+ .demo-card-title,
455
+ .demo-btn {
292
456
  transition: none;
457
+ }
293
458
 
294
- &:hover {
295
- translate: none;
296
- }
459
+ .demo-card:hover:not(:has(.demo-btn-secondary:hover)) {
460
+ translate: none;
297
461
  }
298
462
  }
299
463
  }
@@ -10,7 +10,7 @@ All demos live inside `src/`. Use clear, descriptive `kebab-case` names for all
10
10
  - **Standalone demo** (directly inside `src/`):
11
11
  ```text
12
12
  src/<demo-name>/
13
- ├── index.html
13
+ ├── index.html # or Pen entry files (e.g. index.pen.html)
14
14
  ├── styles.css # optional
15
15
  ├── scripts.js # optional
16
16
  ├── .cdpn.json # CodePen sync metadata (when synced via CodePen Commander)
@@ -37,9 +37,9 @@ All demos live inside `src/`. Use clear, descriptive `kebab-case` names for all
37
37
 
38
38
  Every demo folder MUST be self-contained and portable so it can be opened, served, or copied independently without breaking—and so it syncs cleanly as a standalone CodePen 2.0 Pen:
39
39
 
40
- 1. **Entry point**:
41
- - Include an `index.html` entry point so `codepen-demokit` discovers the demo and renders it cleanly in the browser.
42
- - For Pens cloned or forked from CodePen via `cdpn`, preserve their existing file layout unless the user explicitly asks to reorganize them.
40
+ 1. **Entry point / `.cdpn.json` discovery**:
41
+ - `codepen-demokit` discovers and lists any folder inside `src/` that contains a `.cdpn.json`, `index.html`, or Classic Pen `index.pen.html` file.
42
+ - Include an `index.html` entry point so standalone demos render cleanly in the browser, or preserve the existing file layout (e.g., `index.pen.html` + `.codepen/` + `.cdpn.json`, or `package.json` with CodePen's `packages` block) for Pens cloned or forked from CodePen via `cdpn`—`codepen-demokit` automatically handles CodePen's `classic` and `packages` blocks in both `start` and `build`.
43
43
  2. **Local assets stay inside the demo folder**:
44
44
  - Store local files (stylesheets, scripts, images, SVGs, fonts, media, data files) inside that demo's folder and reference them with relative paths (`./...`).
45
45
  3. **No cross-demo coupling**:
@@ -55,8 +55,9 @@ This repository uses `codepen-demokit` (powered by CodePen Commander / `cdpn` un
55
55
  - `npm run cdpn:pull` — pull remote updates (supports `-- --force`)
56
56
  - `npm run cdpn:delete` — delete linked Pens on CodePen while keeping Pen metadata (`--keep-info`) in `.cdpn.json`
57
57
  - All bulk commands support optional folder scoping (e.g., `npm run cdpn:push -- scroll-driven-animations`) and `-- --dry-run`.
58
- - Cloning a Pen into `src/`:
58
+ - Cloning or scaffolding a Pen into `src/`:
59
59
  - `npm run cdpn:clone -- [options] <url> [folder]` — passes arguments through to `cdpn clone` inside `src/` using `codepen.user` from `config.json` (e.g., `npm run cdpn:clone -- https://codepen.io/user/pen/slug group/my-demo`).
60
+ - `npm run cdpn:new -- [options] [folder]` — passes arguments through to `cdpn new` inside `src/` using `codepen.user` from `config.json` (e.g., `npm run cdpn:new -- group/my-demo`).
60
61
  - Other single-Pen commands via `npx cdpn`:
61
62
  - Pass `--json` and explicit flags when running non-interactively (e.g., `-t "<title>"`, `--access <Public|Private|Protected|Collaborators>`, `-m "<label>"`, `--yes`).
62
63
  - Sync metadata files:
@@ -66,11 +67,11 @@ This repository uses `codepen-demokit` (powered by CodePen Commander / `cdpn` un
66
67
 
67
68
  ## 4. Keeping the Demo Index Up to Date
68
69
 
69
- - The web index page and `dist/demos.json` are **automatically built** by `codepen-demokit` from `src/` subfolders (reading each demo's `<title>`, optional `<meta name="description">`, and optional `.cdpn.json` URL). Never manually edit `dist/`.
70
+ - The web index page and `dist/demos.json` are **automatically built** by `codepen-demokit` from `src/` subfolders containing a `.cdpn.json` or `index.html` file (reading each demo's title/description from `index.html` and/or `.cdpn.json`, plus any `.cdpn.json` URL). Never manually edit `dist/`.
70
71
  - Whenever you add, clone, fork, scaffold, push to CodePen for the first time, rename, move, or remove a demo, update the `## Demos` section in `README.md`.
71
72
 
72
73
  ## 5. Local Verification
73
74
 
74
- - Give each demo's `index.html` a descriptive `<title>` and an optional `<meta name="description" content="...">` (displayed automatically on the index card).
75
+ - Give each demo's `index.html` a descriptive `<title>` and an optional `<meta name="description" content="...">` (or set `info.title` / `info.description` in `.cdpn.json`) so it displays cleanly on the index card.
75
76
  - Preview locally with `npm start` (serves at `http://127.0.0.1:3000`), or `npm start "group/demo"` to serve a single demo directly as the root.
76
77
  - Verify static production builds with `npm run build` (outputs deployable static site to `dist/`).
@@ -38,6 +38,7 @@ npm run cdpn:push # Push local edits and create Pens for unlinked demos
38
38
  npm run cdpn:pull # Pull remote updates for linked demos
39
39
  npm run cdpn:delete # Delete linked Pens on CodePen (retains Pen info in .cdpn.json)
40
40
  npm run cdpn:clone -- <url> [folder] # Clone a Pen into src/ via `cdpn clone`
41
+ npm run cdpn:new -- [folder] # Scaffold a new Pen in src/ via `cdpn new`
41
42
  ```
42
43
 
43
44
  Scope any bulk sync command to a group, subgroup, or single demo folder inside `src/`, and pass `--dry-run` to preview: