codepen-commander 1.3.0 → 1.4.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.
Files changed (92) hide show
  1. package/README.md +103 -11
  2. package/api/client.js +129 -106
  3. package/cli.js +34 -29
  4. package/commands/auth/default.js +40 -0
  5. package/commands/auth/index.js +83 -0
  6. package/commands/auth/list.js +78 -0
  7. package/commands/auth/login.js +136 -0
  8. package/commands/auth/logout.js +186 -0
  9. package/commands/auth/status.js +212 -0
  10. package/commands/build.js +256 -0
  11. package/commands/clone.js +13 -581
  12. package/commands/delete.js +548 -80
  13. package/commands/deploy.js +164 -169
  14. package/commands/domains.js +83 -39
  15. package/commands/fork.js +13 -317
  16. package/commands/info.js +152 -0
  17. package/commands/init.js +375 -0
  18. package/commands/list.js +95 -78
  19. package/commands/new.js +155 -83
  20. package/commands/open.js +29 -19
  21. package/commands/privacy.js +52 -36
  22. package/commands/pull.js +123 -110
  23. package/commands/push.js +221 -376
  24. package/commands/restore.js +251 -0
  25. package/commands/rollback.js +141 -0
  26. package/commands/serve.js +119 -0
  27. package/commands/settings.js +126 -0
  28. package/commands/shell.js +305 -0
  29. package/commands/status.js +133 -39
  30. package/commands/sync.js +330 -0
  31. package/commands/undeploy.js +102 -0
  32. package/commands/unlink.js +191 -0
  33. package/commands/versions.js +100 -163
  34. package/config/auth.js +4 -374
  35. package/config/pen-blocks.js +166 -0
  36. package/config/project.js +103 -231
  37. package/config/user-store.js +364 -0
  38. package/constants.js +42 -0
  39. package/errors.js +17 -0
  40. package/package.json +1 -1
  41. package/shell/index.html +79 -0
  42. package/shell/scripts.js +276 -0
  43. package/shell/styles.css +492 -0
  44. package/site/blocks/classic.js +270 -0
  45. package/site/blocks/context.js +63 -0
  46. package/site/blocks/index.js +4 -0
  47. package/site/blocks/packages.js +242 -0
  48. package/site/blocks/unsupported-page.js +328 -0
  49. package/site/builder.js +475 -0
  50. package/site/detect.js +65 -0
  51. package/site/ignore-files.js +90 -0
  52. package/site/manifest.js +227 -0
  53. package/site/server.js +483 -0
  54. package/site/shell.js +363 -0
  55. package/sync/fs.js +19 -17
  56. package/sync/info.js +6 -81
  57. package/utils/browser.js +17 -10
  58. package/utils/cli-options.js +79 -0
  59. package/utils/codepen-url.js +183 -0
  60. package/utils/format.js +39 -30
  61. package/utils/fs-safe.js +95 -0
  62. package/utils/html.js +40 -1
  63. package/utils/json.js +4 -19
  64. package/utils/output.js +37 -0
  65. package/utils/package-paths.js +51 -0
  66. package/utils/prompts/index.js +5 -0
  67. package/utils/prompts/multi-select.js +185 -0
  68. package/utils/prompts/secret.js +65 -0
  69. package/utils/prompts/select.js +141 -0
  70. package/utils/prompts/text.js +99 -0
  71. package/utils/prompts/tty-list.js +165 -0
  72. package/utils/prompts/types.js +35 -0
  73. package/utils/strings.js +98 -0
  74. package/utils/watcher.js +82 -0
  75. package/{commands → workflows}/auth-context.js +13 -7
  76. package/workflows/batch-pens.js +1647 -0
  77. package/workflows/batch-target.js +184 -0
  78. package/workflows/classic-convert.js +241 -0
  79. package/workflows/clone-pen.js +381 -0
  80. package/{commands → workflows}/create-pen.js +59 -84
  81. package/workflows/discover-pens.js +91 -0
  82. package/workflows/fork-pen.js +314 -0
  83. package/workflows/missing-pen.js +212 -0
  84. package/workflows/pull-pen.js +204 -0
  85. package/workflows/push-pen.js +318 -0
  86. package/{commands → workflows}/scaffold.js +4 -3
  87. package/workflows/sync-pen.js +227 -0
  88. package/{commands → workflows}/unowned-pen.js +16 -12
  89. package/commands/auth.js +0 -593
  90. package/commands/meta.js +0 -184
  91. package/utils/prompts.js +0 -316
  92. /package/{types.js → api/types.js} +0 -0
@@ -0,0 +1,364 @@
1
+ import fs from 'node:fs/promises';
2
+ import { CliError } from '../errors.js';
3
+ import { hasControlChars, isPlainObject } from '../utils/strings.js';
4
+ import { API_KEY_FILENAME, DEFAULT_PROFILE_NAME, getApiKeyFilePath, isValidProfileName, validateProfileName, } from './auth.js';
5
+ const SINGLE_KEY_FIELDS = ['api_key', 'apiKey', 'key', 'token'];
6
+ const RESERVED_STORE_KEYS = new Set([
7
+ 'default',
8
+ 'defaultProfile',
9
+ 'default_profile',
10
+ 'profiles',
11
+ 'config',
12
+ 'shell',
13
+ ]);
14
+ export function normalizeGlobalConfig(raw) {
15
+ if (!isPlainObject(raw)) {
16
+ return {};
17
+ }
18
+ const config = {};
19
+ if (typeof raw.shell === 'string') {
20
+ const trimmed = raw.shell.trim();
21
+ if (trimmed && !hasControlChars(trimmed)) {
22
+ config.shell = trimmed;
23
+ }
24
+ }
25
+ return config;
26
+ }
27
+ export function hasGlobalConfig(config) {
28
+ if (!config)
29
+ return false;
30
+ return Boolean(config.shell && config.shell.trim());
31
+ }
32
+ function extractKeyFromValue(value) {
33
+ if (typeof value === 'string') {
34
+ const trimmed = value.trim();
35
+ return trimmed || null;
36
+ }
37
+ if (isPlainObject(value)) {
38
+ for (const field of SINGLE_KEY_FIELDS) {
39
+ const candidate = value[field];
40
+ if (typeof candidate === 'string' && candidate.trim()) {
41
+ return candidate.trim();
42
+ }
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ function createEmptyStore() {
48
+ return {
49
+ defaultProfile: null,
50
+ profiles: Object.create(null),
51
+ };
52
+ }
53
+ function extractGlobalConfigFromRecord(record) {
54
+ const nested = normalizeGlobalConfig(record.config);
55
+ if (!nested.shell && typeof record.shell === 'string') {
56
+ const trimmed = record.shell.trim();
57
+ if (trimmed && !hasControlChars(trimmed)) {
58
+ nested.shell = trimmed;
59
+ }
60
+ }
61
+ return nested;
62
+ }
63
+ /**
64
+ * Parses `~/.cdpn` content into a normalized multi-profile `AuthStore` + global `config`.
65
+ *
66
+ * Preserves full backwards compatibility with legacy file formats:
67
+ * - Multi-profile JSON: `{ "default": "bramus", "profiles": { ... }, "config"?: { "shell": "..." } }`
68
+ * - Flat JSON map: `{ "bramus": "cp_user_...", "team": "cp_team_..." }`
69
+ * - Single-key JSON: `{ "api_key": "..." }` / `{ "key": "..." }` / `{ "token": "..." }`
70
+ * - Plain raw key (`cp_user_...`) or env assignment (`export CODEPEN_API_KEY="..."`)
71
+ */
72
+ export function parseAuthStoreContent(raw) {
73
+ const trimmed = raw.trim();
74
+ if (!trimmed) {
75
+ return createEmptyStore();
76
+ }
77
+ if (trimmed.startsWith('{')) {
78
+ try {
79
+ const parsed = JSON.parse(trimmed);
80
+ if (!isPlainObject(parsed)) {
81
+ return createEmptyStore();
82
+ }
83
+ const profiles = Object.create(null);
84
+ const config = extractGlobalConfigFromRecord(parsed);
85
+ const configField = hasGlobalConfig(config) ? { config } : {};
86
+ // Format 1: { "default": "...", "profiles": { ... }, "config"?: { ... } }
87
+ if (isPlainObject(parsed.profiles)) {
88
+ for (const [name, entry] of Object.entries(parsed.profiles)) {
89
+ if (!isValidProfileName(name))
90
+ continue;
91
+ const key = extractKeyFromValue(entry);
92
+ if (key) {
93
+ profiles[name.trim()] = key;
94
+ }
95
+ }
96
+ const profileNames = Object.keys(profiles);
97
+ const rawDefault = typeof parsed.default === 'string'
98
+ ? parsed.default.trim()
99
+ : typeof parsed.defaultProfile === 'string'
100
+ ? parsed.defaultProfile.trim()
101
+ : typeof parsed.default_profile === 'string'
102
+ ? parsed.default_profile.trim()
103
+ : '';
104
+ const defaultProfile = rawDefault && Object.hasOwn(profiles, rawDefault)
105
+ ? rawDefault
106
+ : (profileNames[0] ?? null);
107
+ return { defaultProfile, profiles, ...configField };
108
+ }
109
+ // Format 2: Single-key JSON ({ "api_key": "..." })
110
+ for (const field of SINGLE_KEY_FIELDS) {
111
+ const value = parsed[field];
112
+ if (typeof value === 'string' && value.trim()) {
113
+ profiles[DEFAULT_PROFILE_NAME] = value.trim();
114
+ return { defaultProfile: DEFAULT_PROFILE_NAME, profiles, ...configField };
115
+ }
116
+ }
117
+ // Format 3: Flat map JSON ({ "bramus": "cp_user_...", "team": "cp_team_..." })
118
+ for (const [name, entry] of Object.entries(parsed)) {
119
+ if (RESERVED_STORE_KEYS.has(name) || !isValidProfileName(name))
120
+ continue;
121
+ const key = extractKeyFromValue(entry);
122
+ if (key) {
123
+ profiles[name.trim()] = key;
124
+ }
125
+ }
126
+ const profileNames = Object.keys(profiles);
127
+ if (profileNames.length > 0) {
128
+ const rawDefault = typeof parsed.default === 'string' ? parsed.default.trim() : '';
129
+ const defaultProfile = rawDefault && Object.hasOwn(profiles, rawDefault)
130
+ ? rawDefault
131
+ : (profileNames[0] ?? null);
132
+ return { defaultProfile, profiles, ...configField };
133
+ }
134
+ return { defaultProfile: null, profiles, ...configField };
135
+ }
136
+ catch {
137
+ return createEmptyStore();
138
+ }
139
+ }
140
+ // Format 4: Plain key or env assignment line
141
+ for (const line of trimmed.split(/\r?\n/)) {
142
+ const cleanLine = line.trim();
143
+ if (!cleanLine || cleanLine.startsWith('#'))
144
+ continue;
145
+ const envMatch = cleanLine.match(/^(?:export\s+)?CODEPEN_API_KEY\s*=\s*(.+)$/);
146
+ const key = envMatch?.[1]
147
+ ? envMatch[1].trim().replace(/^['"]|['"]$/g, '').trim()
148
+ : cleanLine.replace(/^['"]|['"]$/g, '').trim();
149
+ if (key) {
150
+ const profiles = Object.create(null);
151
+ profiles[DEFAULT_PROFILE_NAME] = key;
152
+ return { defaultProfile: DEFAULT_PROFILE_NAME, profiles };
153
+ }
154
+ }
155
+ return createEmptyStore();
156
+ }
157
+ export async function readAuthStore(options = {}) {
158
+ const filePath = getApiKeyFilePath(options.homeDir);
159
+ try {
160
+ const stat = await fs.lstat(filePath);
161
+ if (!stat.isFile()) {
162
+ return {
163
+ store: createEmptyStore(),
164
+ filePath,
165
+ exists: false,
166
+ insecurePermissions: false,
167
+ };
168
+ }
169
+ const content = await fs.readFile(filePath, 'utf8');
170
+ const insecurePermissions = process.platform !== 'win32' && (stat.mode & 0o077) !== 0;
171
+ return {
172
+ store: parseAuthStoreContent(content),
173
+ filePath,
174
+ exists: true,
175
+ insecurePermissions,
176
+ };
177
+ }
178
+ catch (error) {
179
+ if (error.code === 'ENOENT') {
180
+ return {
181
+ store: createEmptyStore(),
182
+ filePath,
183
+ exists: false,
184
+ insecurePermissions: false,
185
+ };
186
+ }
187
+ throw error;
188
+ }
189
+ }
190
+ /**
191
+ * Writes the multi-profile store and global config to `~/.cdpn` with strict owner-only (`0o600`) file permissions.
192
+ */
193
+ export async function writeAuthStore(store, options = {}) {
194
+ const filePath = getApiKeyFilePath(options.homeDir);
195
+ const sortedProfiles = {};
196
+ for (const name of Object.keys(store.profiles).sort((a, b) => a.localeCompare(b))) {
197
+ const validName = validateProfileName(name);
198
+ const key = store.profiles[name]?.trim();
199
+ if (key) {
200
+ sortedProfiles[validName] = key;
201
+ }
202
+ }
203
+ const names = Object.keys(sortedProfiles);
204
+ const resolvedDefault = store.defaultProfile && Object.hasOwn(sortedProfiles, store.defaultProfile)
205
+ ? store.defaultProfile
206
+ : (names[0] ?? null);
207
+ const normalizedConfig = normalizeGlobalConfig(store.config);
208
+ const includeConfig = hasGlobalConfig(normalizedConfig);
209
+ const payload = {
210
+ ...(resolvedDefault ? { default: resolvedDefault } : {}),
211
+ ...(names.length > 0 ? { profiles: sortedProfiles } : {}),
212
+ ...(includeConfig ? { config: normalizedConfig } : {}),
213
+ };
214
+ await fs.writeFile(filePath, `${JSON.stringify(payload, null, 2)}\n`, {
215
+ encoding: 'utf8',
216
+ mode: 0o600,
217
+ });
218
+ if (process.platform !== 'win32') {
219
+ await fs.chmod(filePath, 0o600);
220
+ }
221
+ return filePath;
222
+ }
223
+ /**
224
+ * Adds or updates a named profile inside `~/.cdpn` (creating the file with `0o600` permissions).
225
+ */
226
+ export async function saveProfileToFile(profileName, apiKey, options = {}) {
227
+ const validProfile = validateProfileName(profileName);
228
+ const trimmedKey = apiKey.trim();
229
+ if (!trimmedKey) {
230
+ throw new CliError(400, 'Cannot save an empty API key.');
231
+ }
232
+ const { store } = await readAuthStore({ homeDir: options.homeDir });
233
+ store.profiles[validProfile] = trimmedKey;
234
+ const hasValidDefault = Boolean(store.defaultProfile && Object.hasOwn(store.profiles, store.defaultProfile));
235
+ if (options.setAsDefault || !hasValidDefault) {
236
+ store.defaultProfile = validProfile;
237
+ }
238
+ const filePath = await writeAuthStore(store, { homeDir: options.homeDir });
239
+ return {
240
+ filePath,
241
+ profile: validProfile,
242
+ isDefault: store.defaultProfile === validProfile,
243
+ };
244
+ }
245
+ export async function setDefaultProfile(profileName, options = {}) {
246
+ const validProfile = validateProfileName(profileName);
247
+ const { store } = await readAuthStore(options);
248
+ if (!Object.hasOwn(store.profiles, validProfile)) {
249
+ const available = Object.keys(store.profiles);
250
+ const hint = available.length > 0
251
+ ? ` Available profiles: ${available.join(', ')}.`
252
+ : ` Run \`cdpn auth login --profile ${validProfile}\` first.`;
253
+ throw new CliError(404, `Profile "${validProfile}" not found in ~/${API_KEY_FILENAME}.${hint}`, {
254
+ requested_profile: validProfile,
255
+ available_profiles: available,
256
+ });
257
+ }
258
+ store.defaultProfile = validProfile;
259
+ return writeAuthStore(store, options);
260
+ }
261
+ export async function removeProfileFromFile(profileName, options = {}) {
262
+ const validProfile = validateProfileName(profileName);
263
+ const { store, exists } = await readAuthStore(options);
264
+ if (!exists || !Object.hasOwn(store.profiles, validProfile)) {
265
+ return {
266
+ removed: false,
267
+ remainingProfiles: Object.keys(store.profiles),
268
+ newDefault: store.defaultProfile,
269
+ fileDeleted: false,
270
+ };
271
+ }
272
+ delete store.profiles[validProfile];
273
+ const remaining = Object.keys(store.profiles).sort((a, b) => a.localeCompare(b));
274
+ if (remaining.length === 0) {
275
+ if (hasGlobalConfig(store.config)) {
276
+ store.defaultProfile = null;
277
+ await writeAuthStore(store, options);
278
+ return { removed: true, remainingProfiles: [], newDefault: null, fileDeleted: false };
279
+ }
280
+ await removeApiKeyFile(options);
281
+ return { removed: true, remainingProfiles: [], newDefault: null, fileDeleted: true };
282
+ }
283
+ if (store.defaultProfile === validProfile) {
284
+ store.defaultProfile = remaining[0] ?? null;
285
+ }
286
+ await writeAuthStore(store, options);
287
+ return {
288
+ removed: true,
289
+ remainingProfiles: remaining,
290
+ newDefault: store.defaultProfile,
291
+ fileDeleted: false,
292
+ };
293
+ }
294
+ /**
295
+ * Removes all stored API key profiles from `~/.cdpn`, deleting the file only when no global config remains.
296
+ */
297
+ export async function clearAllProfilesFromFile(options = {}) {
298
+ const { store, exists } = await readAuthStore(options);
299
+ const profileNames = Object.keys(store.profiles).sort((a, b) => a.localeCompare(b));
300
+ if (!exists || profileNames.length === 0) {
301
+ return { removed: false, removedProfiles: [], fileDeleted: false };
302
+ }
303
+ if (hasGlobalConfig(store.config)) {
304
+ store.profiles = Object.create(null);
305
+ store.defaultProfile = null;
306
+ await writeAuthStore(store, options);
307
+ return { removed: true, removedProfiles: profileNames, fileDeleted: false };
308
+ }
309
+ const deleted = await removeApiKeyFile(options);
310
+ return { removed: true, removedProfiles: profileNames, fileDeleted: deleted };
311
+ }
312
+ export async function removeApiKeyFile(options = {}) {
313
+ const filePath = getApiKeyFilePath(options.homeDir);
314
+ try {
315
+ await fs.unlink(filePath);
316
+ return true;
317
+ }
318
+ catch (error) {
319
+ if (error.code === 'ENOENT') {
320
+ return false;
321
+ }
322
+ throw error;
323
+ }
324
+ }
325
+ export async function readGlobalConfig(options = {}) {
326
+ const { store, filePath, exists } = await readAuthStore(options);
327
+ return {
328
+ config: normalizeGlobalConfig(store.config),
329
+ filePath,
330
+ exists,
331
+ };
332
+ }
333
+ export async function getConfiguredShellDir(options = {}) {
334
+ const { config } = await readGlobalConfig(options);
335
+ return config.shell ?? null;
336
+ }
337
+ export async function setConfiguredShellDir(shellDir, options = {}) {
338
+ const trimmed = shellDir.trim();
339
+ if (!trimmed || hasControlChars(trimmed)) {
340
+ throw new CliError(400, 'Shell directory path cannot be empty or contain control characters.');
341
+ }
342
+ const { store } = await readAuthStore(options);
343
+ const nextConfig = normalizeGlobalConfig(store.config);
344
+ nextConfig.shell = trimmed;
345
+ store.config = nextConfig;
346
+ const filePath = await writeAuthStore(store, options);
347
+ return { filePath, shellDir: trimmed };
348
+ }
349
+ export async function clearConfiguredShellDir(options = {}) {
350
+ const { store, filePath, exists } = await readAuthStore(options);
351
+ const currentConfig = normalizeGlobalConfig(store.config);
352
+ if (!exists || !currentConfig.shell) {
353
+ return { filePath, cleared: false, fileDeleted: false };
354
+ }
355
+ delete currentConfig.shell;
356
+ store.config = hasGlobalConfig(currentConfig) ? currentConfig : undefined;
357
+ const hasProfiles = Object.keys(store.profiles).length > 0;
358
+ if (!hasProfiles && !hasGlobalConfig(store.config)) {
359
+ const deleted = await removeApiKeyFile(options);
360
+ return { filePath, cleared: true, fileDeleted: deleted };
361
+ }
362
+ await writeAuthStore(store, options);
363
+ return { filePath, cleared: true, fileDeleted: false };
364
+ }
package/constants.js ADDED
@@ -0,0 +1,42 @@
1
+ export const PROJECT_CONFIG_FILENAME = '.cdpn.json';
2
+ export const IGNORE_FILENAME = '.cdpnignore';
3
+ export const CODEPEN_DIR = '.codepen';
4
+ export const PEN_CONFIG_FILENAME = 'pen.config.json';
5
+ export const CLASSIC_CONFIG_FILENAME = 'classic.config.json';
6
+ export const PEN_HTML_SUFFIX = '.pen.html';
7
+ export const CODEPEN_API_SETTINGS_URL = 'https://codepen.io/settings/api';
8
+ export const CODEPEN_DELETED_ITEMS_URL = 'https://codepen.io/your-work?item_type=DELETED_ITEMS';
9
+ /** CodePen's documented max multipart request size (120 MB). */
10
+ export const MAX_MULTIPART_BYTES = 120 * 1024 * 1024;
11
+ /** CodePen's documented max single file size (30 MB). */
12
+ export const MAX_FILE_BYTES = 30 * 1024 * 1024;
13
+ /** CodePen's documented max tags per Pen. */
14
+ export const MAX_PEN_TAGS = 5;
15
+ /** CodePen's documented max version label length. */
16
+ export const MAX_VERSION_LABEL_LENGTH = 80;
17
+ /** CodePen's documented minimum password length for Protected Pens. */
18
+ export const MIN_PROTECTED_PASSWORD_LENGTH = 8;
19
+ export const VALID_PEN_ACCESS_LOWER = new Set([
20
+ 'public',
21
+ 'private',
22
+ 'protected',
23
+ 'collaborators',
24
+ ]);
25
+ export const PEN_ACCESS_CHOICES = Object.freeze([
26
+ { value: 'Public', label: 'Public', description: 'visible to everyone' },
27
+ {
28
+ value: 'Private',
29
+ label: 'Private',
30
+ description: 'unlisted; anyone with the link can view it',
31
+ },
32
+ {
33
+ value: 'Protected',
34
+ label: 'Protected',
35
+ description: 'private and password-protected (min 8 chars)',
36
+ },
37
+ {
38
+ value: 'Collaborators',
39
+ label: 'Collaborators',
40
+ description: 'private; visible only to you and collaborators',
41
+ },
42
+ ]);
package/errors.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Structured CLI error carrying an HTTP-modeled status code and optional structured contents
3
+ * for `--json` output while remaining a standard `Error` for human-readable terminal output.
4
+ */
5
+ export class CliError extends Error {
6
+ statusCode;
7
+ contents;
8
+ constructor(statusCode, message, contents = null) {
9
+ super(message);
10
+ this.name = 'CliError';
11
+ this.statusCode = statusCode;
12
+ this.contents = contents;
13
+ }
14
+ }
15
+ export function isCliError(error) {
16
+ return error instanceof CliError;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codepen-commander",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Sync local folders with CodePen 2.0 Pens via the CodePen API v2",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,79 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="color-scheme" content="light dark">
7
+ <title>{{SITE_TITLE}}</title>
8
+ <link rel="stylesheet" href="./styles.css">
9
+ <script type="module" src="./scripts.js"></script>
10
+ </head>
11
+ <body>
12
+ <header class="site-header">
13
+ <h1>{{SITE_TITLE}}</h1>
14
+ <p class="subtitle">{{SITE_SUBTITLE}}</p>
15
+ </header>
16
+
17
+ <main class="demo-directory" id="demo-directory">
18
+ <p class="directory-status">Loading demos…</p>
19
+ <noscript>
20
+ <section class="empty-state">
21
+ <h2>JavaScript required</h2>
22
+ <p>Enable JavaScript to load the list of demos from <code>demos.json</code>.</p>
23
+ </section>
24
+ </noscript>
25
+ </main>
26
+
27
+ <footer class="site-footer">
28
+ <p>{{SITE_FOOTER}}</p>
29
+ </footer>
30
+
31
+ <template id="demo-card-template">
32
+ <li class="demo-card">
33
+ <div class="demo-path">
34
+ <code class="demo-path-text"></code>
35
+ </div>
36
+ <div class="demo-body">
37
+ <p class="demo-description"></p>
38
+ <ul class="demo-tags" aria-label="Tags"></ul>
39
+ </div>
40
+ <div class="demo-footer">
41
+ <a class="demo-btn demo-btn-primary demo-open">
42
+ <svg class="demo-btn-icon demo-open-icon" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
43
+ <path d="M4.75 3.1a.75.75 0 0 1 1.13-.65l7.5 4.4a.75.75 0 0 1 0 1.3l-7.5 4.4a.75.75 0 0 1-1.13-.65V3.1Z" />
44
+ </svg>
45
+ <span>Open Demo</span>
46
+ </a>
47
+ <a class="demo-btn demo-btn-secondary demo-codepen" target="_blank" rel="noopener noreferrer">
48
+ <svg class="demo-btn-icon demo-codepen-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
49
+ <polygon points="8,1.5 14.5,5.5 8,9.5 1.5,5.5" />
50
+ <polygon points="8,6.5 14.5,10.5 8,14.5 1.5,10.5" />
51
+ <line x1="1.5" y1="5.5" x2="1.5" y2="10.5" />
52
+ <line x1="14.5" y1="5.5" x2="14.5" y2="10.5" />
53
+ <line x1="8" y1="1.5" x2="8" y2="6.5" />
54
+ <line x1="8" y1="9.5" x2="8" y2="14.5" />
55
+ </svg>
56
+ <span>Edit on CodePen</span>
57
+ </a>
58
+ </div>
59
+ </li>
60
+ </template>
61
+
62
+ <template id="empty-state-template">
63
+ <section class="empty-state">
64
+ <h2>No CodePen demos found</h2>
65
+ </section>
66
+ </template>
67
+
68
+ <template id="missing-demo-warning-template">
69
+ <aside class="shell-warning" role="note">
70
+ <svg class="shell-warning-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
71
+ <path d="M8 2 14.5 13.5h-13L8 2Z" />
72
+ <line x1="8" y1="6.2" x2="8" y2="9.4" />
73
+ <circle cx="8" cy="11.5" r="0.6" fill="currentColor" stroke="none" />
74
+ </svg>
75
+ <p>Missing a demo? Run <code>cdpn init</code> in it to mark it as a CodePen demo.</p>
76
+ </aside>
77
+ </template>
78
+ </body>
79
+ </html>