@panomc/theme-core 1.0.0-dev.46 → 1.0.0-dev.47

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.
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ <svg width="128" height="256" viewBox="0 0 128 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="128" height="256" rx="4.8" fill="#72C076"/>
3
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 186.05 279.07">
2
+ <defs>
3
+ <style>.a,.b{fill:#fff;}.a{opacity:0.7;}</style>
4
+ </defs>
5
+ <path class="a" d="M0,232.56v16.51a30,30,0,0,0,30,30H63a30,30,0,0,0,30-30V186H46.51S0,186,0,232.56Z"/>
6
+ <path class="b"
7
+ d="M156,0H30A30,30,0,0,0,0,30V232.56C0,186,46.51,186,46.51,186H156a30,30,0,0,0,30-30V30A30,30,0,0,0,156,0Z"/>
8
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="128" height="128" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="128" height="128" rx="4.8" fill="#E9573F"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="256" height="128" viewBox="0 0 256 128" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="256" height="128" rx="4.8" fill="#F6BB42"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/bin/new.js CHANGED
@@ -265,6 +265,7 @@ build/
265
265
  plugins/
266
266
  static/runtime/
267
267
  static/lib/
268
+ static/assets/
268
269
  src/lib/server/license-constants.generated.js
269
270
  `,
270
271
 
package/bin/sync.js CHANGED
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * Run from the THEME's root: bun node_modules/@panomc/theme-core/bin/sync.js
15
15
  */
16
- import { mkdirSync, writeFileSync, readFileSync, existsSync, readdirSync, statSync, rmSync } from "node:fs";
16
+ import { mkdirSync, writeFileSync, readFileSync, existsSync, readdirSync, statSync, rmSync, copyFileSync } from "node:fs";
17
17
  import { join, dirname } from "node:path";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import { createRequire } from "node:module";
@@ -333,6 +333,56 @@ function backfillTokens() {
333
333
  console.log("theme-core sync: filled in the token menu in src/styles/tokens.scss");
334
334
  }
335
335
 
336
+ /**
337
+ * Static assets the engine's components and SCSS reference by absolute URL
338
+ * (/assets/img/logo.svg, quicksand fonts, FontAwesome webfonts). A thin theme
339
+ * doesn't carry them in git — they're synced into static/assets/ here.
340
+ * Existing files are NEVER overwritten, so a theme can brand its own
341
+ * logo.svg (or any other asset) by simply replacing the file.
342
+ */
343
+ function syncStaticAssets() {
344
+ const themeRequire = createRequire(join(process.cwd(), "package.json"));
345
+ const staticDir = join(process.cwd(), "static");
346
+ let copied = 0;
347
+
348
+ const copyTree = (fromDir, toDir) => {
349
+ if (!existsSync(fromDir)) return;
350
+ mkdirSync(toDir, { recursive: true });
351
+ for (const entry of readdirSync(fromDir)) {
352
+ const from = join(fromDir, entry);
353
+ const to = join(toDir, entry);
354
+ if (statSync(from).isDirectory()) {
355
+ copyTree(from, to);
356
+ } else if (!existsSync(to)) {
357
+ copyFileSync(from, to);
358
+ copied++;
359
+ }
360
+ }
361
+ };
362
+
363
+ const engineAssets = join(dirname(fileURLToPath(import.meta.url)), "..", "assets");
364
+ copyTree(join(engineAssets, "img"), join(staticDir, "assets", "img"));
365
+ if (existsSync(join(engineAssets, "robots.txt")) && !existsSync(join(staticDir, "robots.txt"))) {
366
+ copyFileSync(join(engineAssets, "robots.txt"), join(staticDir, "robots.txt"));
367
+ copied++;
368
+ }
369
+
370
+ try {
371
+ const sdkDir = dirname(themeRequire.resolve("@panomc/sdk/package.json"));
372
+ copyTree(join(sdkDir, "core", "fonts"), join(staticDir, "assets", "fonts"));
373
+ } catch {
374
+ /* sdk not installed yet — next sync run picks the fonts up */
375
+ }
376
+ try {
377
+ const faDir = dirname(themeRequire.resolve("@fortawesome/fontawesome-free/package.json"));
378
+ copyTree(join(faDir, "webfonts"), join(staticDir, "assets", "webfonts"));
379
+ } catch {
380
+ /* fontawesome not installed yet — next sync run picks the webfonts up */
381
+ }
382
+
383
+ return copied;
384
+ }
385
+
336
386
  const routesDir = join(process.cwd(), "src", "routes");
337
387
  let written = 0;
338
388
  let ejected = 0;
@@ -385,7 +435,8 @@ sweep(routesDir);
385
435
 
386
436
  const langMerged = syncLang();
387
437
  backfillTokens();
438
+ const assetsCopied = syncStaticAssets();
388
439
 
389
440
  console.log(
390
- `${pc.green("✓")} ${pc.bold("theme-core sync")} — ${written} shims written, ${ejected} ejected (kept), ${removed} stale removed, ${langMerged} lang files merged`,
441
+ `${pc.green("✓")} ${pc.bold("theme-core sync")} — ${written} shims written, ${ejected} ejected (kept), ${removed} stale removed, ${langMerged} lang files merged, ${assetsCopied} assets copied`,
391
442
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panomc/theme-core",
3
- "version": "1.0.0-dev.46",
3
+ "version": "1.0.0-dev.47",
4
4
  "description": "The Pano theme engine: hooks factories, plugin engine, headless page controllers, default views and the theme CLI. Themes depend on this package instead of forking vanilla-theme.",
5
5
  "author": "PanoMC",
6
6
  "license": "MIT",
@@ -41,6 +41,7 @@
41
41
  "src",
42
42
  "bin",
43
43
  "lang",
44
+ "assets",
44
45
  "skin-contract.json"
45
46
  ],
46
47
  "publishConfig": {