uniweb 0.5.4 → 0.5.6

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/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "uniweb",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Create structured Vite + React sites with content/code separation",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "uniweb": "src/index.js"
8
8
  },
9
+ "exports": {
10
+ "./processor": "./src/templates/processor.js"
11
+ },
9
12
  "files": [
10
13
  "src",
11
14
  "templates",
@@ -37,9 +40,9 @@
37
40
  "js-yaml": "^4.1.0",
38
41
  "prompts": "^2.4.2",
39
42
  "tar": "^7.0.0",
40
- "@uniweb/core": "0.3.4",
41
- "@uniweb/runtime": "0.5.4",
42
- "@uniweb/build": "0.4.3",
43
- "@uniweb/kit": "0.4.4"
43
+ "@uniweb/kit": "0.4.6",
44
+ "@uniweb/runtime": "0.5.6",
45
+ "@uniweb/core": "0.3.6",
46
+ "@uniweb/build": "0.4.3"
44
47
  }
45
48
  }
@@ -824,6 +824,149 @@ Theme is defined in `foundation/src/styles.css`:
824
824
 
825
825
  Use with: `bg-primary`, `text-primary`, `bg-primary/10` (10% opacity)
826
826
 
827
+ ## Converting an Existing Design
828
+
829
+ When given a monolithic React/JSX file (e.g., a landing page built with an AI tool) to convert into a Uniweb project, follow this approach.
830
+
831
+ ### Mindset
832
+
833
+ The goal is a page that **renders identically** to the original, but the implementation logic changes. You are not porting code line-by-line — you are decomposing a monolithic design into the Uniweb content/component architecture.
834
+
835
+ **Don't preserve source component names.** A monolithic file might have components named after specific content (e.g., `Institutions`, `ProximifyCTA`). Uniweb foundation components are **generic rendering agencies named for purpose**, not for the content they happen to display. A section showing an institutional quote is rendered by a component like `Testimonial` or `Quote` — something reusable for any quote, not tied to one client.
836
+
837
+ ### Step 1: Identify Sections
838
+
839
+ Each visually distinct block in the design becomes:
840
+ - An **exposed component** in `foundation/src/components/` (with `meta.js`)
841
+ - A **markdown file** in `site/pages/` (with `type:` referencing that component)
842
+
843
+ Look for natural section boundaries — full-width blocks separated by spacing, background changes, or horizontal rules.
844
+
845
+ ### Step 2: Separate Content from Code
846
+
847
+ For each section, ask: **what is content and what is design?**
848
+
849
+ | In the JSX source | In Uniweb |
850
+ |---|---|
851
+ | Hardcoded heading text | `# Heading` in markdown → `content.title` |
852
+ | Hardcoded paragraph text | Paragraph in markdown → `content.paragraphs[]` |
853
+ | Hardcoded link/button text and URLs | `[Label](url)` in markdown → `content.links[]` |
854
+ | Hardcoded images | `![Alt](path)` in markdown → `content.imgs[]` |
855
+ | Repeating card/item structures | H3 groups in markdown → `content.items[]` |
856
+ | Icon references (e.g., `lucide-react`) | `![](lu-iconname)` in markdown → `content.icons[]` |
857
+ | Layout, spacing, colors, animations | Component JSX + Tailwind classes |
858
+ | Visual elements with no content (diagrams, decorations) | Component JSX only — no markdown equivalent |
859
+
860
+ ### Step 3: Name Components for Purpose
861
+
862
+ Choose names that describe **what the component does**, not what content it currently shows:
863
+
864
+ | Source name | Better Uniweb name | Why |
865
+ |---|---|---|
866
+ | `ProximifyCTA` | `CallToAction` | Renders any CTA, not just one brand's |
867
+ | `Institutions` | `Testimonial` or `Quote` | Renders any testimonial |
868
+ | `WorkModes` | `FeatureColumns` | Renders any set of features in columns |
869
+ | `TheModel` | `SplitContent` | Text on one side, visual on the other |
870
+
871
+ ### Step 4: Design Params Beyond the Original
872
+
873
+ Exposed components should define **params in `meta.js`** that make them flexible, even if the original design only uses one variant. For example:
874
+
875
+ ```javascript
876
+ // A component that's always "dark" in the source design
877
+ // should still support theme switching
878
+ params: {
879
+ theme: {
880
+ type: 'select',
881
+ options: ['light', 'dark'],
882
+ default: 'dark', // Matches the original design
883
+ },
884
+ align: {
885
+ type: 'select',
886
+ options: ['left', 'center'],
887
+ default: 'center',
888
+ },
889
+ }
890
+ ```
891
+
892
+ The original design becomes the **default preset**. But a content author can reconfigure.
893
+
894
+ ### Step 5: Create Internal Components
895
+
896
+ Not every React component in the source becomes an exposed Uniweb component. Shared UI elements like buttons, cards, and badges are **internal components** — they live in `foundation/src/shared/` (or similar) with **no `meta.js`**:
897
+
898
+ ```
899
+ foundation/src/
900
+ ├── components/ # Exposed (with meta.js) — selectable from markdown
901
+ │ ├── Hero/
902
+ │ ├── FeatureGrid/
903
+ │ └── CallToAction/
904
+ ├── shared/ # Internal (no meta.js) — used by exposed components
905
+ │ ├── Button.jsx
906
+ │ ├── Badge.jsx
907
+ │ └── SectionWrapper.jsx
908
+ └── styles.css
909
+ ```
910
+
911
+ Internal components are imported by exposed components but are invisible to content authors. This is normal and encouraged — it keeps the content interface clean.
912
+
913
+ ### Step 6: Map Special Sections
914
+
915
+ | Source pattern | Uniweb equivalent |
916
+ |---|---|
917
+ | Navigation / navbar | `@header/` special page with a Header component |
918
+ | Footer | `@footer/` special page with a Footer component |
919
+ | Sticky/fixed elements | Header component using `useScrolled()` hook |
920
+ | Mobile menu toggle | Header component using `useMobileMenu()` hook |
921
+
922
+ ### Step 7: Extract Design Tokens
923
+
924
+ Colors, fonts, and spacing from the source become Tailwind theme variables:
925
+
926
+ ```css
927
+ /* foundation/src/styles.css */
928
+ @import "tailwindcss";
929
+ @source "./components/**/*.jsx";
930
+ @source "./shared/**/*.jsx";
931
+ @source "../node_modules/@uniweb/kit/src/**/*.jsx";
932
+
933
+ @theme {
934
+ --color-primary: #0f172a; /* From the source's main color */
935
+ --color-accent: #10b981; /* From the source's accent color */
936
+ }
937
+ ```
938
+
939
+ ### Example: Converting a Landing Page
940
+
941
+ Given a file with `Nav`, `Hero`, `Features`, `Testimonial`, `CTA`, `Footer`:
942
+
943
+ **Foundation components created:**
944
+ - `Hero/` — full-width hero with heading, text, buttons
945
+ - `FeatureGrid/` — grid of feature cards with icons
946
+ - `Testimonial/` — quote with attribution
947
+ - `CallToAction/` — dark-background CTA section
948
+ - `Header/` — navigation bar (for `@header`)
949
+ - `Footer/` — site footer (for `@footer`)
950
+
951
+ **Internal helpers:**
952
+ - `shared/Button.jsx` — reusable button styles
953
+ - `shared/SectionWrapper.jsx` — consistent section padding/width
954
+
955
+ **Site content:**
956
+ ```
957
+ site/pages/
958
+ ├── @header/
959
+ │ └── 1-nav.md # type: Header
960
+ ├── @footer/
961
+ │ └── 1-footer.md # type: Footer (links as markdown)
962
+ └── home/
963
+ ├── page.yml
964
+ ├── 1-hero.md # type: Hero
965
+ ├── 2-features.md # type: FeatureGrid (items from H3 groups)
966
+ ├── 3-testimonial.md # type: Testimonial
967
+ └── 4-cta.md # type: CallToAction
968
+ ```
969
+
827
970
  ## Troubleshooting
828
971
 
829
972
  **"Could not load foundation"**
@@ -1,3 +1,26 @@
1
1
  ## AI Assistance
2
2
 
3
- See [AGENTS.md](./AGENTS.md) for detailed instructions that AI assistants can use.
3
+ This project includes an [AGENTS.md](./AGENTS.md) file with detailed instructions for AI coding assistants (Claude Code, Cursor, Copilot, etc.).
4
+
5
+ ### Example Prompts
6
+
7
+ **Converting an existing design:**
8
+ ```
9
+ I have a landing page design in `homepage.jsx`. Convert it into this Uniweb
10
+ project. Decompose each visual section into a foundation component and extract
11
+ all text content into markdown files in site/pages/home/. The final page
12
+ should render identically to the original. See AGENTS.md for the full guide.
13
+ ```
14
+
15
+ **Adding a new component:**
16
+ ```
17
+ Create a Pricing component with 3-column cards. It should support light and
18
+ dark themes. Use content.items for the pricing tiers — each item has a title,
19
+ paragraph (price), and links (CTA button).
20
+ ```
21
+
22
+ **Adding a new page:**
23
+ ```
24
+ Add a /contact page with a hero section and a form section. Reuse the Hero
25
+ component from the homepage. Create a new ContactForm component for the form.
26
+ ```