soames-astro-theme 0.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.
Files changed (46) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +67 -0
  3. package/package.json +68 -0
  4. package/src/components/Bio.tsx +36 -0
  5. package/src/components/BlogSidebar.tsx +48 -0
  6. package/src/components/DocsSidebar.tsx +45 -0
  7. package/src/components/Footer.tsx +59 -0
  8. package/src/components/FooterMenu.tsx +36 -0
  9. package/src/components/Header.tsx +57 -0
  10. package/src/components/HeaderMenu.tsx +77 -0
  11. package/src/components/HeroHeader.tsx +66 -0
  12. package/src/components/Logo.tsx +37 -0
  13. package/src/components/shortcodes/RemoveContentAreaPadding.tsx +13 -0
  14. package/src/components/shortcodes/Shortcodes.tsx +319 -0
  15. package/src/components/shortcodes/SoamesFeature.tsx +54 -0
  16. package/src/components/shortcodes/SoamesGalleryMenu.tsx +90 -0
  17. package/src/components/shortcodes/SoamesIconList.tsx +90 -0
  18. package/src/components/shortcodes/SoamesSoundCloud.tsx +71 -0
  19. package/src/components/shortcodes/SoamesTextBlock.tsx +27 -0
  20. package/src/components/shortcodes/SoamesTextList.tsx +27 -0
  21. package/src/components/shortcodes/SoamesTitle.tsx +24 -0
  22. package/src/components/shortcodes/SoamesTitleBar.tsx +22 -0
  23. package/src/components/shortcodes/SoamesTitleBarLg.tsx +56 -0
  24. package/src/components/shortcodes/SoamesVideo.tsx +35 -0
  25. package/src/components/shortcodes/getAttributes.ts +19 -0
  26. package/src/components/shortcodes/getContent.ts +4 -0
  27. package/src/integration.ts +147 -0
  28. package/src/layouts/Base.astro +93 -0
  29. package/src/lib/wp.ts +351 -0
  30. package/src/routes/[...uri].astro +41 -0
  31. package/src/routes/blog/[...page].astro +88 -0
  32. package/src/routes/blog/post/[...slug].astro +79 -0
  33. package/src/routes/docs/[...slug].astro +58 -0
  34. package/src/routes/docs/index.astro +66 -0
  35. package/src/routes/index.astro +39 -0
  36. package/src/scripts/soames-nav.js +72 -0
  37. package/src/styles/site-overrides.css +4 -0
  38. package/src/styles/soames/base.css +593 -0
  39. package/src/styles/soames/components.css +1556 -0
  40. package/src/styles/soames/layout.css +209 -0
  41. package/src/styles/soames/overrides.css +2138 -0
  42. package/src/styles/soames/typography.css +23 -0
  43. package/src/styles/theme.css +8 -0
  44. package/src/styles/vendor/normalize.css +343 -0
  45. package/src/styles/vendor/wordpress-blocks.css +3451 -0
  46. package/src/theme-shadow.ts +39 -0
@@ -0,0 +1,39 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import type { Plugin } from 'vite';
4
+
5
+ // Replicates Gatsby component shadowing on Astro/Vite (proven in ORBI-24 spike).
6
+ //
7
+ // An import of `@theme/<rel>` resolves to the SITE OVERRIDE (`<overrideDir>/<rel>`)
8
+ // if that file exists, otherwise the THEME default (`<themeDir>/<rel>`). Same
9
+ // import specifier → different file. Path-keyed, whole-file replacement, resolved
10
+ // at build time. This is the successor to Gatsby's `src/<theme-name>/<path>` shadowing.
11
+ const EXTS = ['', '.tsx', '.ts', '.jsx', '.js', '.astro', '/index.tsx', '/index.ts'];
12
+
13
+ export interface ThemeShadowOptions {
14
+ /** The theme package's source root (defaults resolved by the integration). */
15
+ themeDir: string;
16
+ /** The consuming site's override dir, e.g. <site>/src/overrides. */
17
+ overrideDir: string;
18
+ /** Import prefix to intercept. */
19
+ prefix?: string;
20
+ }
21
+
22
+ export function themeShadow({ themeDir, overrideDir, prefix = '@theme/' }: ThemeShadowOptions): Plugin {
23
+ return {
24
+ name: 'soames-theme-shadow',
25
+ enforce: 'pre',
26
+ resolveId(source: string) {
27
+ if (!source.startsWith(prefix)) return null;
28
+ const rel = source.slice(prefix.length);
29
+ // Override wins over theme — mirrors Gatsby's site-shadows-theme precedence.
30
+ for (const base of [overrideDir, themeDir]) {
31
+ for (const ext of EXTS) {
32
+ const full = path.join(base, rel + ext);
33
+ if (fs.existsSync(full) && fs.statSync(full).isFile()) return full;
34
+ }
35
+ }
36
+ return null;
37
+ },
38
+ };
39
+ }