@semplice-studio/pa-design-system 0.1.1 → 0.2.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.
package/README.md CHANGED
@@ -1,166 +1,123 @@
1
- # Coding-Agent Project Template
1
+ # @semplice-studio/pa-design-system
2
2
 
3
- A boilerplate that captures the Sapra.ai development methodology — a **Plan first, Develop second** workflow optimized for working with a coding agent like Claude Code.
3
+ Vue 3 design system for Italian **Pubblica Amministrazione (PA)** web portals accessible, brand-consistent components and design tokens, by [Semplice](https://semplice.is).
4
4
 
5
- This template doesn't ship application code. It ships the **scaffolding the agent needs** to make good decisions in your project: a structured `CLAUDE.md`, a `docs/` knowledge base, and a set of skills (`/init-prd`, `/import-design-system`, `/data-model`, `/user-story`, `/ui-composer`, `/figma-component`) that drive the project from empty repo to shipped feature.
5
+ - **41 components** (15 atoms + 26 composed) forms, navigation, overlays, data display, date/time pickers
6
+ - **Design tokens as CSS custom properties**, with Inter + Roboto Mono bundled via `@font-face`
7
+ - **Accessibility-first**: WAI-ARIA patterns, keyboard navigation, focus management — built toward Italian PA requirements (AgID / Legge Stanca)
8
+ - **ESM-only**, tree-shakeable, typed (`.d.ts` for every component)
9
+ - Italian default labels everywhere, overridable via props for other locales
6
10
 
7
- ## Philosophy
11
+ > ⚠️ **Pre-1.0**: minor versions may contain breaking changes until `v1.0.0`.
8
12
 
9
- - **Knowledge as code.** Everything the agent needs to know lives in version-controlled markdown — no tribal knowledge, no Slack archeology.
10
- - **One conversation per phase.** Each skill is a guided Q&A that produces one durable artifact (PRD, design system, data model, user story).
11
- - **Plan first, develop second.** No code is written before a plan is confirmed. Stories are drafted before they're built. Components are mapped before they're composed.
12
- - **Per-step approval.** The agent never batch-implements. Every user story gets its own approval gate.
13
+ ## Requirements
13
14
 
14
- ## The flow
15
+ - Vue **≥ 3.4**
16
+ - Node **≥ 20** (build tooling)
15
17
 
16
- There are two flavors depending on what you're building. Pick one bootstrap skill at step 2 — the rest is identical.
18
+ ## Installation
17
19
 
18
- ### Product / app project
19
-
20
- ```
21
- 1. Clone this template → empty repo with .claude/ + docs/ scaffolding
22
- 2. /init-prd → dialog → docs/prd.md + populated CLAUDE.md
23
- 3. /import-design-system → Figma → docs/frontend/design-system.md + tokens
24
- 4. /data-model → dialog → docs/data-model.md + schema sketch
25
- 5. /user-story <topic> → Q&A → docs/user-stories/user-stories-vX.X.md
26
- 6. /user-story implement vX.X → loop: plan → approve → implement → tick AC
27
- 7. git commit → one bundled commit per story
28
- ```
29
-
30
- ### Library / npm package project (e.g. a Vue design system)
31
-
32
- ```
33
- 1. Clone this template → empty repo with .claude/ + docs/ scaffolding
34
- 2. /init-library → dialog → docs/prd.md (library spec) + CLAUDE.md
35
- + optional package.json + tsconfig + build config
36
- 3. /import-design-system → Figma → docs/frontend/design-system.md + tokens
37
- 4. (skip /data-model — libraries have no data model)
38
- 5. /user-story <component> → Q&A → docs/user-stories/user-stories-vX.X.md
39
- 6. /user-story implement vX.X → loop: plan → approve → /figma-component → tick AC
40
- 7. git commit → one bundled commit per story (or per component)
20
+ ```bash
21
+ pnpm add @semplice-studio/pa-design-system
22
+ # or: npm install / yarn add
41
23
  ```
42
24
 
43
- The two paths are mutually exclusive you pick `/init-prd` or `/init-library` once per project, not both.
25
+ `@phosphor-icons/vue` and `v-calendar` are installed automatically as dependencies; `vue` is a peer.
44
26
 
45
- ## How this maps to software development phases
27
+ ## Quickstart Nuxt 3/4
46
28
 
47
- The template isn't a novel methodology — it's a classic software development lifecycle, reorganized so that **every phase produces an agent-readable artifact** and **every artifact accumulates into a living knowledge base**.
48
-
49
- The flow has two macro-phases:
50
-
51
- - **Setup** — one-shot at project start. Produces the blueprints.
52
- - **Iteration** — repeated forever, one user story at a time. Produces the software.
29
+ ```ts
30
+ // nuxt.config.ts
31
+ export default defineNuxtConfig({
32
+ css: [
33
+ '@semplice-studio/pa-design-system/tokens.css',
34
+ '@semplice-studio/pa-design-system/style.css',
35
+ ],
36
+ })
37
+ ```
53
38
 
54
- A third theme runs across both: **knowledge accumulation**. Every skill writes back to `docs/`, so every future agent session starts with more context, not less.
39
+ ```vue
40
+ <script setup lang="ts">
41
+ import { PaButton, PaInput } from '@semplice-studio/pa-design-system'
42
+ </script>
55
43
 
56
- ### Setup phase (one-shot)
44
+ <template>
45
+ <PaInput v-model="name" label="Nome" />
46
+ <PaButton @click="submit">Invia</PaButton>
47
+ </template>
48
+ ```
57
49
 
58
- | SDLC phase | Skill | Artifact | Inputs the next phase will consume |
59
- |---|---|---|---|
60
- | Requirements / discovery | `/init-prd` (product) or `/init-library` (npm package) | `docs/prd.md` + populated `CLAUDE.md` | Personas/package surface, scope, stack, constraints |
61
- | UX / visual design | `/import-design-system` | `docs/frontend/design-system.md` + token files + Figma→component recognition rules | Components available, token names, icon registry |
62
- | System / data design | `/data-model` | `docs/data-model.md` + ORM schema sketch | Entities, relationships, indexes, RLS policies *(skip for library projects)* |
50
+ ## Quickstart plain Vue + Vite
63
51
 
64
- After setup: the project has a complete blueprint. No production code yet — every downstream decision will be anchored to these artifacts.
52
+ ```ts
53
+ // main.ts
54
+ import '@semplice-studio/pa-design-system/tokens.css'
55
+ import '@semplice-studio/pa-design-system/style.css'
56
+ ```
65
57
 
66
- ### Iteration phase (repeated per release)
58
+ Then import components where you use them — no plugin, no global registration.
67
59
 
68
- | SDLC phase | Skill | Artifact | Notes |
69
- |---|---|---|---|
70
- | Sprint planning | `/user-story <topic>` | `docs/user-stories/user-stories-vX.X.md` | One file per release. Stories scoped, AC testable, files listed. |
71
- | Implementation | `/user-story implement vX.X` | Source code + ticked AC | Per-step approval. Calls `/ui-composer` and `/figma-component` as sub-skills when needed. |
72
- | Component design (sub-skill) | `/figma-component <Name> <figma-url>` | Component file + design-system.md update (status 🟡 → ✅) | Only when a story needs a new atom. |
73
- | Page composition (sub-skill) | `/ui-composer` | Page file with mock data, AC checklist | Only when a story scaffolds a page from existing atoms. |
74
- | Review / merge | (manual) | git commit per story | One bundled commit per story; commit message follows `feat(area): <summary> (US-NN)`. |
60
+ ## Imports
75
61
 
76
- After each iteration: the codebase grows and the docs grow with it. The next agent session has more context than the previous one — never less.
62
+ ```ts
63
+ // barrel — tree-shaken by your bundler
64
+ import { PaButton, PaModal } from '@semplice-studio/pa-design-system'
77
65
 
78
- ### Cross-cutting — continuous documentation
66
+ // or per-component subpath
67
+ import { PaButton } from '@semplice-studio/pa-design-system/components/PaButton'
68
+ ```
79
69
 
80
- Nothing lives in tribal knowledge. Every skill writes to `docs/`:
70
+ Every component also exports its prop/option types (`PaButtonProps`, `PaSelectOption`, …).
81
71
 
82
- - `/figma-component` updates `docs/frontend/design-system.md` (component status, prop tables, recognition rules)
83
- - `/user-story implement` ticks acceptance criteria (✅) in the story file and proposes commits
84
- - New conventions discovered during implementation get appended to the relevant `docs/tech/*.md`
85
- - `/data-model` is re-runnable when entities change — diffs against the existing model
72
+ ## Stylesheets
86
73
 
87
- This is what makes the methodology agent-ready: the project state lives in markdown, not in anyone's head.
74
+ | Entry | Contents |
75
+ |---|---|
76
+ | `tokens.css` | Design tokens (`--pa-color-*`, `--pa-space-*`, `--pa-font-*`, …) + bundled Inter / Roboto Mono `@font-face` — no separate font loading needed. Auto-imports `layout.css`. |
77
+ | `layout.css` | `.pa-*` layout/composition utilities (also importable standalone) |
78
+ | `style.css` | Compiled component styles |
88
79
 
89
- ### Typical use case — bootstrapping a Vue design system as an npm package
80
+ ## Theming
90
81
 
91
- A concrete walkthrough mapping each step to its SDLC phase:
82
+ All component styling resolves through CSS custom properties override them at the consumer level, no build-time config:
92
83
 
93
- **Day 1 morning — Requirements**
84
+ ```css
85
+ :root {
86
+ --pa-color-primary: #0a5fad;
87
+ }
94
88
  ```
95
- git clone <template> dx-design-system && cd dx-design-system && claude
96
- > /init-library
97
- ```
98
- The agent Q&As through 18 questions (package name, target framework, build tool, peer deps, distribution shape). ~30 min later: `docs/prd.md` is filled with the library spec, `CLAUDE.md` is populated, optional `package.json` + `tsconfig.json` + build config are scaffolded. *Phase: Requirements engineering.*
99
89
 
100
- **Day 1 afternoon Visual design**
101
- ```
102
- > /import-design-system
103
- ```
104
- The agent extracts color/typography/spacing/radius tokens from Figma, enumerates atoms and composed components, builds the icon registry. Output: `docs/frontend/design-system.md` (every component marked 🟡 designed, awaiting implementation), `src/tokens/*.css`, Figma→component recognition rules seeded. *Phase: UX/visual design.*
90
+ ## Component reference & agent docs
105
91
 
106
- **(Skip `/data-model`libraries have no data model.)**
92
+ These docs ship **inside the package** (`node_modules/@semplice-studio/pa-design-system/docs/`), version-locked to the installed release point your coding agent at them:
107
93
 
108
- **Day 2 morning Sprint planning**
109
- ```
110
- > /user-story tokens wiring + 5 base atoms (Button, Input, Badge, Tag, Icon) + Histoire setup
111
- ```
112
- The agent Q&As scope, AC, file paths, dependencies. Output: `docs/user-stories/user-stories-v1.1.md` with ~6 user stories (US-01 → US-06), each with concrete AC and file paths. *Phase: Sprint planning.*
94
+ - [`docs/public-surface.md`](docs/public-surface.md)export table: every component with its props/v-model/slots/emits summary
95
+ - [`docs/page-composition-examples.md`](docs/page-composition-examples.md) — page skeleton + section patterns distilled from the reference templates
96
+ - [`docs/layouts.md`](docs/layouts.md) the `.pa-*` layout utility classes
97
+ - [`docs/design-system.md`](docs/design-system.md) — design tokens + component registry
113
98
 
114
- **Day 2-3 Implementation**
115
- ```
116
- > /user-story implement v1.1
117
- ```
118
- For each US-NN: agent proposes a plan → user approves → agent calls `/figma-component UiButton <figma-url>` as a sub-skill → component generated → `docs/frontend/design-system.md` updated (status 🟡 → ✅) → AC ticked → commit suggested (`feat(button): add UiButton with primary/outline/ghost variants (US-01)`). Loop continues for each story. *Phase: Implementation, with continuous documentation woven in.*
99
+ For live examples, run the Histoire playground (see Development).
119
100
 
120
- **Day 4 Next iteration**
121
- ```
122
- > /user-story Composed components: Card, Header, Sidebar
123
- ```
124
- The agent reads `CLAUDE.md`, `docs/prd.md`, `docs/frontend/design-system.md` (now with 5 ✅ atoms it can compose with), and the previous user-stories file as structural reference. Phase B repeats — but the knowledge base is bigger and the agent's plans are sharper. *Phase: next iteration of sprint planning + implementation.*
101
+ Conventions that apply across the library:
125
102
 
126
- The compounding effect is the point: by Day 30, when you onboard a teammate (or a fresh agent session), they don't ask "where do I start?" they read `CLAUDE.md`, follow the references, and have the project's full context in 15 minutes.
103
+ - **Shared form anatomy**: form components mirror `PaInput`'s `label` / `helperText` / `error` / `valid` / `required` / `disabled` / `readonly` set
104
+ - **Date/time pickers**: values normalized to *local* midnight (never UTC); with `name` set, a hidden input serializes for native form posts
105
+ - **Responsive components use container queries** — they reflow inside narrow sidebars regardless of viewport
106
+ - **SPA routing**: nav components (`PaBreadcrumb`, headers, footer) emit preventable payloads — call `preventDefault()` and route with your router
127
107
 
128
- ## What's in the box
108
+ ## Development
129
109
 
110
+ ```bash
111
+ pnpm install
112
+ pnpm dev # Histoire playground
113
+ pnpm test # Vitest (watch)
114
+ pnpm build # library build + type emit
115
+ pnpm typecheck
116
+ pnpm lint
130
117
  ```
131
- template/
132
- ├── AUDIT.md ← what's reusable methodology vs Sapra-specific
133
- ├── CLAUDE.md ← skeleton with {{TODO}} slots filled by skills
134
- ├── .claude/skills/
135
- │ ├── init-prd/ ← NEW: bootstrap a product/app project
136
- │ ├── init-library/ ← NEW: bootstrap a library/npm package project
137
- │ ├── import-design-system/ ← NEW: Figma → design-system.md + tokens
138
- │ ├── data-model/ ← NEW: entities + relationships → data-model.md
139
- │ ├── user-story/ ← LIFTED from Sapra (deparametrized)
140
- │ ├── ui-composer/ ← LIFTED from Sapra (deparametrized)
141
- │ └── figma-component/ ← LIFTED from Sapra (deparametrized, now a skill)
142
- └── docs/
143
- ├── workflow.md ← Plan-first/Develop-second workflow rules
144
- ├── prd.md ← empty template, filled by /init-prd
145
- ├── data-model.md ← empty template, filled by /data-model
146
- ├── frontend/
147
- │ └── design-system.md ← empty template, filled by /import-design-system
148
- └── user-stories/ ← created per release by /user-story
149
- ```
150
-
151
- ## How to use
152
-
153
- 1. Copy `template/` contents to a fresh repo (the `template/` folder itself is for reference inside Sapra)
154
- 2. Open it in Claude Code — the agent reads `CLAUDE.md` on session start
155
- 3. Decide: is this a **product** or a **library**?
156
- - Product/app → run `/init-prd`. Q&A through tech stack, product surface, constraints
157
- - Library (npm package, design system, SDK) → run `/init-library`. Q&A through package surface, peer deps, build, distribution
158
- 4. Run `/import-design-system` once your designer has a Figma file ready
159
- 5. Run `/data-model` to lock down entities before any backend work — **skip for library projects**
160
- 6. From there: `/user-story` per feature/component, then `implement vX.X` per release
161
118
 
162
- ## Stack-agnostic but with framework hooks
119
+ Releases use [changesets](https://github.com/changesets/changesets): `pnpm changeset` → `pnpm changeset version` → commit → `pnpm release` → `git push --follow-tags`. Published publicly on npmjs.com (`publishConfig.access: public`); publishing requires npm 2FA.
163
120
 
164
- The methodology is stack-agnostic. The `/ui-composer` and `/figma-component` skills, however, need framework-specific references (which Vue patterns? React? Svelte?). They read `CLAUDE.md` to discover the stack chosen by `/init-prd`, then look up the right reference under `.claude/skills/<skill>/references/frameworks/`. v0 of this template ships Vue/Nuxt as the only framework reference (lifted from Sapra) — adding React/Next is a matter of dropping a new file in `references/frameworks/`.
121
+ ## License
165
122
 
166
- See `AUDIT.md` for the full breakdown of what was reusable, what was project-specific, and what needed generalization.
123
+ [EUPL-1.2](LICENSE) © Semplice
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as G, useModel as H, ref as M, computed as n, watch as J, onBeforeUnmount as Q, openBlock as u, createElementBlock as c, normalizeClass as p, createTextVNode as X, toDisplayString as C, createCommentVNode as v, withKeys as S, withModifiers as q, createElementVNode as g, renderSlot as Z, createVNode as y, withDirectives as ee, unref as ae, withCtx as L, vShow as te, mergeModels as ie } from "vue";
2
2
  import { DatePicker as ne } from "v-calendar";
3
- import "v-calendar/style.css";
3
+ /* empty css */
4
4
  import E from "../PaIcon/PaIcon.vue.js";
5
5
  const re = ["for"], le = {
6
6
  key: 0,
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as ne, useModel as re, ref as y, computed as o, watch as le, onBeforeUnmount as ie, openBlock as f, createElementBlock as m, normalizeClass as D, createTextVNode as oe, toDisplayString as F, createCommentVNode as k, withKeys as V, withModifiers as _, createElementVNode as w, renderSlot as de, createVNode as M, withDirectives as se, unref as ue, withCtx as W, vShow as ce, mergeModels as ve } from "vue";
2
2
  import { DatePicker as ge } from "v-calendar";
3
- import "v-calendar/style.css";
3
+ /* empty css */
4
4
  import B from "../PaIcon/PaIcon.vue.js";
5
5
  const fe = ["for"], me = {
6
6
  key: 0,