@panomc/theme-core 1.0.0-dev.46 → 1.0.0-dev.48
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/assets/img/404.png +0 -0
- package/assets/img/default-header-bg.png +0 -0
- package/assets/img/green.svg +3 -0
- package/assets/img/logo.svg +8 -0
- package/assets/img/red.svg +3 -0
- package/assets/img/yellow.svg +3 -0
- package/assets/robots.txt +3 -0
- package/bin/new.js +1 -0
- package/bin/sync.js +53 -2
- package/bin/theme-core.js +11 -1
- package/package.json +7 -1
|
Binary file
|
|
Binary file
|
|
@@ -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>
|
package/bin/new.js
CHANGED
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/bin/theme-core.js
CHANGED
|
@@ -18,9 +18,19 @@ import { join, dirname } from "node:path";
|
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import { pc, version, DOCS_URL, brandIntro, outro, note } from "./ui.js";
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
let binDir = dirname(fileURLToPath(import.meta.url));
|
|
22
22
|
const [cmd, ...args] = process.argv.slice(2);
|
|
23
23
|
|
|
24
|
+
// Inside a theme, always drive the THEME's own installed engine, not whatever
|
|
25
|
+
// version bunx happened to fetch (a stale `latest` here would desync the CLI
|
|
26
|
+
// from the code the theme actually runs). `new` is exempt — it creates themes.
|
|
27
|
+
{
|
|
28
|
+
const localBin = join(process.cwd(), "node_modules", "@panomc", "theme-core", "bin");
|
|
29
|
+
if (cmd !== "new" && existsSync(join(localBin, "theme-core.js")) && localBin !== binDir) {
|
|
30
|
+
binDir = localBin;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
function run(script, extra = []) {
|
|
25
35
|
const r = spawnSync("bun", [join(binDir, script), ...extra], {
|
|
26
36
|
stdio: "inherit",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panomc/theme-core",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.48",
|
|
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": {
|
|
@@ -77,5 +78,10 @@
|
|
|
77
78
|
},
|
|
78
79
|
"bin": {
|
|
79
80
|
"theme-core": "./bin/theme-core.js"
|
|
81
|
+
},
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"@panomc/sdk": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
}
|