ropav 0.1.9 → 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.
Files changed (46) hide show
  1. package/README.md +13 -5
  2. package/dist/base.css +570 -773
  3. package/dist/calendar.css +1 -1
  4. package/dist/color-input.css +3 -7
  5. package/dist/color-picker.css +2 -6
  6. package/dist/color-swatch.css +2 -6
  7. package/dist/combobox.css +5 -5
  8. package/dist/componentColors.js +29 -25
  9. package/dist/components/alert/types.d.ts +1 -1
  10. package/dist/components/avatar/types.d.ts +1 -1
  11. package/dist/components/badge/types.d.ts +1 -1
  12. package/dist/components/pagination/types.d.ts +1 -1
  13. package/dist/components/progress/types.d.ts +1 -1
  14. package/dist/components/segmented-control/types.d.ts +1 -1
  15. package/dist/components/slider/types.d.ts +1 -1
  16. package/dist/components/toast/types.d.ts +1 -1
  17. package/dist/date-picker.css +1 -1
  18. package/dist/dropdown-menu.css +7 -7
  19. package/dist/field.css +1 -1
  20. package/dist/hover-card.css +1 -1
  21. package/dist/modal.css +1 -1
  22. package/dist/multi-select.css +5 -5
  23. package/dist/pagination.css +1 -1
  24. package/dist/popover.css +2 -2
  25. package/dist/select.css +5 -5
  26. package/dist/slider.css +3 -3
  27. package/dist/tabs.css +3 -3
  28. package/dist/tags-input.css +1 -1
  29. package/dist/textarea.css +1 -1
  30. package/dist/toast.css +1 -1
  31. package/dist/tooltip.css +1 -1
  32. package/dist/utils/componentColors.d.ts +2 -4
  33. package/docs/code-architecture.md +147 -0
  34. package/docs/public-styles-api.md +8 -6
  35. package/docs/releasing.md +39 -0
  36. package/package.json +37 -16
  37. package/src/styles/_mixins.scss +2 -6
  38. package/src/styles/_tokens.scss +4 -833
  39. package/src/styles/generated/showcase.html +274 -0
  40. package/src/styles/generated/tokens.css +592 -0
  41. package/src/styles/generated/tokens.md +583 -0
  42. package/src/styles/generated/tokens.scss +1134 -0
  43. package/tokens/manifest.json +6164 -0
  44. package/docs/public-tokens.md +0 -685
  45. package/src/styles/_variables.scss +0 -243
  46. package/src/styles/styles-manifest.json +0 -5244
@@ -0,0 +1,147 @@
1
+ # Code architecture
2
+
3
+ This guide defines the source structure expected from contributors. The goal is a predictable
4
+ codebase where UI files describe rendering, behavior is testable through small interfaces, and
5
+ shared logic has one obvious home.
6
+
7
+ ## Package seams
8
+
9
+ This repository publishes `ropav`, a zero-VDOM UI component library for Vue Vapor. Paths such as
10
+ `src/utils/` below are relative to this package's root.
11
+
12
+ The library integrates `@floating-ui/dom` and `focus-trap` through package dependencies, and it
13
+ exposes public composables, component subpath exports, design tokens, and styles through its
14
+ `package.json` exports. Production source stays zero-VDOM: component rendering, style injection,
15
+ and accessible behavior are built with Vue Vapor, never through VDOM interfaces.
16
+
17
+ ## Module seams
18
+
19
+ A module should hide a meaningful amount of behavior behind a small interface. Extract code around
20
+ a responsibility, not merely to reduce a line count. A useful extraction makes callers simpler and
21
+ lets tests exercise the same interface that production code uses.
22
+
23
+ Use this dependency direction:
24
+
25
+ ```text
26
+ Vue components and component-local modules
27
+ -> internal composables
28
+ -> public composables
29
+ -> utilities
30
+ ```
31
+
32
+ A higher layer may also import a lower layer directly. Lower layers must not import higher layers:
33
+
34
+ - `src/utils/` does not import components or composables.
35
+ - `src/composables/` does not import components or internal modules.
36
+ - `src/internal/` does not import components.
37
+ - Components may compose other components when the dependency remains acyclic.
38
+
39
+ ## Where code belongs
40
+
41
+ | Location | Responsibility |
42
+ | ----------------------------------------- | --------------------------------------------------------------------- |
43
+ | `src/components/<name>/*.vue` | Template, bindings, slots, and lightweight view-derived state |
44
+ | `src/components/<name>/useX.ts` | Component-specific reactive state, lifecycle, and event orchestration |
45
+ | `src/components/<name>/<concern>Model.ts` | Pure behavior that encodes only that component's contract |
46
+ | `src/internal/composables/` | Shared reactive behavior that is not part of the package interface |
47
+ | `src/composables/` | Reusable public composables exported by the package |
48
+ | `src/utils/` | Reusable runtime helpers without component state or lifecycle |
49
+ | `src/utils/dom/` | Reusable helpers that operate on browser and DOM primitives |
50
+ | `tests/`, `tooling/`, `scripts/` | Test, build, and repository automation helpers |
51
+
52
+ Do not add catch-all `utils`, `helpers`, or `core` modules beside a component. Keep a pure helper
53
+ local when it expresses one component's contract, and give it a semantic name such as
54
+ `sliderModel`. Move it to `src/utils/` once more than one feature needs the behavior.
55
+
56
+ ## Component shape
57
+
58
+ Production SFCs use `<script setup lang="ts" vapor>` and remain zero-VDOM. Do not use `h`, `VNode`,
59
+ `defineComponent`, `createVNode`, or related VDOM block helpers in production source.
60
+
61
+ Keep SFC blocks in this order:
62
+
63
+ 1. `<template>`
64
+ 2. `<script setup lang="ts" vapor>`
65
+ 3. `<style>`
66
+
67
+ Within the script block, use this order:
68
+
69
+ 1. Imports
70
+ 2. `defineOptions`, props defaults, emits, and slots
71
+ 3. Composable state and template refs
72
+ 4. View-derived computed attributes
73
+ 5. Small event adapters and `defineExpose`
74
+
75
+ A short computed value used only to bind the template can stay in the SFC. Move state transitions,
76
+ timers, document listeners, multi-step event handling, and reusable calculations behind a
77
+ composable or pure model interface.
78
+
79
+ ## Function design
80
+
81
+ Oxlint enforces a conservative baseline of cyclomatic complexity 20, nesting depth 4, at most 5
82
+ parameters, and at most 250 non-blank, non-comment lines per function. These are upper bounds, not
83
+ targets.
84
+
85
+ - Give each function one reason to change.
86
+ - Prefer guard clauses over deeply nested branches.
87
+ - Use an options object when several parameters describe one concept.
88
+ - Split orchestration into named steps, while keeping the external interface small.
89
+ - Accept dependencies or callbacks at the module seam instead of constructing hard-to-test global
90
+ dependencies inside the implementation.
91
+ - Return observable results where practical; isolate side effects in lifecycle or event adapters.
92
+
93
+ Do not create shallow pass-through functions solely to satisfy a metric. A refactor should improve
94
+ the caller, the module interface, or the test surface.
95
+
96
+ ## Imports and package interfaces
97
+
98
+ - Import utilities directly from their module, for example `@/utils/number`; do not add a utils
99
+ barrel.
100
+ - Component `index.ts` files define package-facing exports. Internal code should not import from the
101
+ root package barrel.
102
+ - Keep imports acyclic. If two modules need each other, move the shared behavior to the lowest
103
+ layer that owns the concept.
104
+ - Use `import type` for type-only dependencies.
105
+
106
+ ## Testing
107
+
108
+ Test through the interface of the extracted module:
109
+
110
+ - Pure models and utilities use deterministic unit tests.
111
+ - Composables test returned state and commands, using the smallest host needed for lifecycle
112
+ behavior.
113
+ - Component tests cover DOM integration, events, accessibility, and public rendering contracts.
114
+ - Storybook tests cover visual and interaction scenarios that depend on real browser layout.
115
+
116
+ Tests should assert observable behavior rather than private implementation details. Refactoring a
117
+ module internally should not require rewriting its behavioral tests.
118
+
119
+ ### Storybook organization
120
+
121
+ Keep component stories beside their component at
122
+ `src/components/<name>/<name>.stories.ts`. Use human-readable Storybook titles with this hierarchy:
123
+
124
+ ```text
125
+ Foundations/<name>
126
+ Components/<category>/<name>
127
+ Utilities/<name>
128
+ Contracts/<name>
129
+ ```
130
+
131
+ Component categories are `Actions`, `Data Display`, `Feedback`, `Forms`, `Layout`, `Navigation`,
132
+ and `Overlays`. Foundations document design tokens, utilities demonstrate lower-level package
133
+ capabilities, and contracts exercise cross-component or browser integration behavior.
134
+
135
+ ## Contributor checklist
136
+
137
+ Before opening a pull request:
138
+
139
+ - The SFC primarily adapts props, slots, and composable results to the template.
140
+ - New reusable helpers live in `src/utils/`; feature-only pure logic has a semantic local name.
141
+ - Dependency direction remains downward and acyclic.
142
+ - Functions stay below the enforced complexity, depth, length, and parameter limits.
143
+ - New behavior is tested at the module interface.
144
+ - The package defines a `verify` script for package-owned type, test, build, and bundle behavior.
145
+ - Lint, formatting, architecture, and zero-VDOM bundle contracts run from the root verification
146
+ interface.
147
+ - `pnpm verify` passes from the repository root.
@@ -121,13 +121,15 @@ Active menu and listbox descendants use `data-highlighted`. Actual DOM keyboard
121
121
 
122
122
  ## Public CSS variables
123
123
 
124
- The exact entries in [`styles-manifest.json`](../src/styles/styles-manifest.json) are the public contract. A design token enters that manifest only when it opts in with `$extensions.ropav.public: true`. Emitting a CSS variable is a separate runtime concern: neither emission nor a name prefix makes a variable public. Undocumented variables, underscore-prefixed variables, DOM structure and internal component selectors are not part of the public contract and may change.
124
+ The exact entries in the packaged [`tokens/manifest.json`](../tokens/manifest.json) (also exported as `ropav/styles-manifest`) are the public contract. A design token enters that manifest only when it opts in with `$extensions.umberkit.public: true`. Emitting a CSS variable is a separate runtime concern: neither emission nor a name prefix makes a variable public. Undocumented variables, underscore-prefixed variables, DOM structure and internal component selectors are not part of the public contract and may change.
125
125
 
126
- The manifest contains design tokens plus a deliberately small component-geometry allowlist. Slider and RangeSlider share the `--rp-slider-*` namespace. Size presets provide fallbacks, while a consumer value wins for the individual dimension. See the generated [token table](./public-tokens.md).
126
+ Tokens are built with [umberkit](https://www.npmjs.com/package/umberkit): 12-step OKLCH palettes generated from one seed per hue (Radix step semantics — 1-2 backgrounds, 3-5 component backgrounds, 6-8 borders, 9-10 solids, 11-12 text), plus hand-authored semantic roles (`--rp-color-<hue>-filled`, `-light`, `-outline`, …) and scheme semantics (`--rp-color-body`, `-text`, `-default`, …). The generated `tokens.md` and `showcase.html` shipped in `src/styles/generated/` document every token and render the ramps with a contrast grid.
127
127
 
128
- The schema-v2 manifest does not pin a Git commit. `tokens:check` resolves compatibility from release tags, so the baseline advances with releases instead of remaining hard-coded.
128
+ A deliberately small component-geometry namespace (`--rp-switch-*`, `--rp-slider-*`, `--rp-radio-*`) stays outside the token tree: those variables are consumer override hooks with size-preset fallbacks, so they are intentionally undefined by default. Slider and RangeSlider share the `--rp-slider-*` namespace; size presets provide fallbacks, while a consumer value wins for the individual dimension.
129
129
 
130
- Palette shades and their normal and active `*-contrast` companions are required override groups because `autoContrast` consumes state-specific companions selected at build time. The [color override contract](./public-tokens.md#color-override-contract) documents the state pairings and preset-role requirements.
130
+ ## Color scheme
131
+
132
+ Every color token is emitted as `light-dark()`. Set `data-scheme="dark"` (or `"light"`) on `<html>` to switch schemes; without the attribute the operating-system preference applies. Because `light-dark()` values resolve against the color scheme of the element they are declared on (`:root`), the attribute must be set on the document element — subtree scheme switching is not supported.
131
133
 
132
134
  ## Cascade layers and migration
133
135
 
@@ -144,6 +146,6 @@ Place global resets in `reset` and application overrides in `app`. Import order
144
146
  - Typed parts, state attributes, manifest entries, geometry variables and cascade layers form the current Public Styles API.
145
147
  - Renaming or removing a documented part, state attribute or variable changes the public contract.
146
148
  - Adding a public part, state attribute or variable extends the public contract.
147
- - `tokens:check` compares the current manifest with the latest reachable `ropav@*` release tag that contains one. Until the first package-specific release exists, it falls back to legacy `v*` tags and their pre-monorepo manifest path. Released variables cannot be removed, renamed or changed semantically; adding a variable requires incrementing the manifest's `contractVersion`.
148
- - Release tags must be available in the Git checkout that runs the check. `PUBLIC_STYLES_BASELINE_REF` can explicitly select another Git ref that contains a manifest.
149
+ - `tokens:check` runs `umberkit check`: lint, generated-palette and manifest drift, and the contract ratchet against the latest reachable `v*` release tag. Removing, renaming, retyping or un-publishing a released public token fails until `contract.version` rises in `umberkit.config.ts`.
150
+ - Release tags must be available in the Git checkout that runs the check (`fetch-depth: 0` in CI). `umberkit check --against <ref>` can explicitly select another baseline.
149
151
  - Internal DOM, selectors and undocumented variables are outside the public contract.
@@ -0,0 +1,39 @@
1
+ # Releasing
2
+
3
+ This repository publishes `ropav` with [`bumpp`](https://www.npmjs.com/package/bumpp). Release notes
4
+ are generated from Conventional Commits, and the package is published from GitHub Actions with npm
5
+ Trusted Publishing.
6
+
7
+ ## Release
8
+
9
+ With a clean working tree, run:
10
+
11
+ ```bash
12
+ pnpm release
13
+ ```
14
+
15
+ `bumpp` bumps the package to the next version (patch/minor/major prompt), runs `pnpm run changelog`
16
+ to regenerate the changelog from commits since the last `v*` tag, then commits
17
+ `chore(release): vX.Y.Z`, tags `vX.Y.Z`, and pushes the commit and tag.
18
+
19
+ Every push to `main` runs the full quality suite. When the pushed commit is a release commit
20
+ (message starts with `chore(release): v`), the release job rebuilds the package, checks the built
21
+ bundles, and publishes it to npm. Change the release commit message in the `release` script and the
22
+ release workflow will need the matching prefix.
23
+
24
+ ## Changelog
25
+
26
+ `pnpm run changelog` regenerates `CHANGELOG.md` from commits since the latest `v*` tag. The release
27
+ flow runs this automatically. The changelog is a tracked file, so the working tree must be clean
28
+ before `pnpm release`.
29
+
30
+ ## Trusted Publisher configuration
31
+
32
+ The npm package is configured as a Trusted Publisher:
33
+
34
+ - GitHub owner: `daopk`
35
+ - Repository: `ropav`
36
+ - Workflow filename: `publish.yml`
37
+
38
+ The workflow uses GitHub-hosted runners, Node 24, and `id-token: write`. Do not add a long-lived npm
39
+ publish token to the workflow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ropav",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,7 +10,8 @@
10
10
  "dist",
11
11
  "docs",
12
12
  "src/styles/**/*.scss",
13
- "src/styles/styles-manifest.json"
13
+ "src/styles/generated",
14
+ "tokens/manifest.json"
14
15
  ],
15
16
  "main": "./dist/index.js",
16
17
  "module": "./dist/index.js",
@@ -225,8 +226,8 @@
225
226
  "import": "./dist/unplugin-icons.js"
226
227
  },
227
228
  "./base.css": "./dist/base.css",
228
- "./styles-manifest": "./src/styles/styles-manifest.json",
229
- "./styles-manifest.json": "./src/styles/styles-manifest.json",
229
+ "./styles-manifest": "./tokens/manifest.json",
230
+ "./styles-manifest.json": "./tokens/manifest.json",
230
231
  "./scss/*.scss": "./src/styles/*.scss"
231
232
  },
232
233
  "peerDependencies": {
@@ -255,15 +256,22 @@
255
256
  "@types/node": "^26.1.1",
256
257
  "@vitejs/plugin-vue": "^6.0.8",
257
258
  "@vitest/browser-playwright": "^4.1.10",
259
+ "@vue/compiler-sfc": "3.6.0-rc.2",
258
260
  "@vue/compiler-vapor": "3.6.0-rc.2",
259
261
  "@vue/tsconfig": "^0.9.1",
262
+ "bumpp": "^12.1.1",
263
+ "conventional-changelog": "^7.1.0",
264
+ "conventional-changelog-conventionalcommits": "^9.3.1",
260
265
  "jsdom": "^29.1.1",
266
+ "oxfmt": "^0.60.0",
267
+ "oxlint": "^1.75.0",
261
268
  "playwright": "^1.61.1",
262
269
  "sass-embedded": "^1.100.0",
263
270
  "storybook": "^10.5.3",
264
271
  "storybook-addon-pseudo-states": "^10.5.3",
265
272
  "style-dictionary": "5.5.0",
266
273
  "typescript": "~6.0.3",
274
+ "umberkit": "0.0.1",
267
275
  "unplugin-icons": "^23.0.1",
268
276
  "vite": "^8.1.5",
269
277
  "vite-plugin-dts": "^5.0.3",
@@ -273,30 +281,43 @@
273
281
  },
274
282
  "repository": {
275
283
  "type": "git",
276
- "url": "https://github.com/daopk/ropav",
277
- "directory": "packages/ropav"
284
+ "url": "https://github.com/daopk/ropav"
285
+ },
286
+ "devEngines": {
287
+ "runtime": {
288
+ "name": "node",
289
+ "version": ">=24.7.0",
290
+ "onFail": "error"
291
+ }
278
292
  },
279
293
  "scripts": {
280
294
  "dev": "pnpm run storybook",
295
+ "lint": "oxlint .",
296
+ "lint:fix": "oxlint . --fix",
297
+ "format": "oxfmt",
298
+ "format:check": "oxfmt --check",
299
+ "changelog": "node scripts/changelog.mjs",
300
+ "release": "test -z \"$(git status --porcelain)\" && bumpp --commit \"chore(release): v{version}\" --tag \"v{version}\" --execute \"pnpm run changelog\"",
301
+ "test:workspace": "node --test tests/*.test.mjs",
281
302
  "publication:sync": "node scripts/sync-package-publication.mjs --write",
282
303
  "publication:check": "node scripts/sync-package-publication.mjs --check",
283
304
  "publication:verify": "node scripts/verify-package-publication.mjs",
284
- "tokens:build": "style-dictionary build --config scripts/tokens.config.mjs --silent",
285
- "tokens:check": "node scripts/check-tokens.mjs",
305
+ "tokens:build": "umberkit generate && umberkit build",
306
+ "tokens:check": "umberkit check",
286
307
  "typecheck": "vue-tsc -b tsconfig.app.json tsconfig.node.json tsconfig.test.json",
287
308
  "typecheck:storybook": "vue-tsc -p tsconfig.storybook.json --noEmit",
288
- "test": "vitest run --project=unit --project=tooling",
309
+ "test": "pnpm run tokens:emit && vitest run --project=unit --project=tooling",
289
310
  "test:consumer-types:built": "tsc -p tests/fixtures/consumer-types/tsconfig.bundler.json && tsc -p tests/fixtures/consumer-types/tsconfig.nodenext.json",
290
311
  "test:bundle:built": "node scripts/check-package-bundle.mjs",
291
312
  "test:consumer-fixture:built": "node tests/fixtures/consumer-app/check.mjs && vue-tsc -p tests/fixtures/consumer-app/tsconfig.json --noEmit && vite build --config tests/fixtures/consumer-app/vite.config.ts && node tests/fixtures/consumer-app/assertions.mjs",
292
313
  "test:package": "pnpm run build && pnpm run publication:verify && pnpm run test:bundle:built && pnpm run test:consumer-types:built && pnpm run test:consumer-fixture:built",
293
- "test:watch": "vitest --project=unit --project=tooling",
294
- "test:typecheck": "vitest run --project=unit --project=tooling --typecheck",
295
- "test:storybook": "vitest run --project=storybook-light --project=storybook-dark",
296
- "build": "pnpm run publication:check && pnpm run tokens:check && pnpm run typecheck && vite build",
297
- "verify": "pnpm run typecheck:storybook && pnpm run test && pnpm run test:storybook && pnpm run test:package",
314
+ "test:watch": "pnpm run tokens:emit && vitest --project=unit --project=tooling",
315
+ "test:storybook": "pnpm run tokens:emit && vitest run --project=storybook-light --project=storybook-dark",
316
+ "build": "pnpm run publication:check && pnpm run tokens:check && pnpm run tokens:emit && pnpm run typecheck && vite build",
317
+ "verify": "pnpm run lint && pnpm run format:check && pnpm run test:workspace && pnpm run typecheck:storybook && pnpm run test && pnpm run test:storybook && pnpm run test:package",
298
318
  "preview": "vite preview",
299
- "storybook": "pnpm run tokens:check && storybook dev -p 6006 --no-open",
300
- "build-storybook": "pnpm run tokens:check && pnpm run typecheck:storybook && storybook build"
319
+ "storybook": "pnpm run tokens:emit && storybook dev -p 6006 --no-open",
320
+ "build-storybook": "pnpm run tokens:emit && pnpm run typecheck:storybook && storybook build",
321
+ "tokens:emit": "umberkit build"
301
322
  }
302
323
  }
@@ -1,8 +1,4 @@
1
- @use 'variables' as *;
2
-
3
- $rp-component-colors:
4
- 'dark', 'gray', 'red', 'pink', 'grape', 'violet', 'indigo', 'blue', 'cyan', 'teal', 'green',
5
- 'lime', 'yellow', 'orange';
1
+ @use 'generated/tokens.scss' as *;
6
2
 
7
3
  @mixin flex-center {
8
4
  display: inline-flex;
@@ -96,7 +92,7 @@ $rp-component-colors:
96
92
  }
97
93
 
98
94
  @mixin menu-surface(
99
- $z-index: $z-index-dropdown,
95
+ $z-index: $rp-z-index-dropdown,
100
96
  $surface: var(--rp-color-default),
101
97
  $radius: var(--rp-radius-lg)
102
98
  ) {