ropav 0.0.12 → 0.1.1

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 (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/card.css +26 -26
  4. package/dist/card.js +6 -16
  5. package/dist/components/card/types.d.ts +0 -3
  6. package/dist/components/dialog/types.d.ts +1 -0
  7. package/dist/components/dropdown-menu/types.d.ts +5 -7
  8. package/dist/components/dropdown-menu/useDropdownMenuRenderItems.d.ts +2 -0
  9. package/dist/components/floating/index.d.ts +1 -1
  10. package/dist/components/floating/types.d.ts +11 -0
  11. package/dist/components/modal/types.d.ts +1 -0
  12. package/dist/components/overlay/index.d.ts +3 -0
  13. package/dist/components/overlay/index.js +3 -2
  14. package/dist/components/overlay/overlay-layer-provider.d.ts +21 -0
  15. package/dist/components/overlay/types.d.ts +10 -1
  16. package/dist/components/overlay/useOverlayZIndex.d.ts +4 -0
  17. package/dist/components/popover/types.d.ts +1 -0
  18. package/dist/components/toast/types.d.ts +1 -0
  19. package/dist/components/tooltip/types.d.ts +1 -0
  20. package/dist/composables/useOverlayLayer.d.ts +1 -1
  21. package/dist/dialog.js +7 -2
  22. package/dist/dropdown-menu.js +34 -23
  23. package/dist/index.js +3 -2
  24. package/dist/modal.css +28 -28
  25. package/dist/modal.js +5 -3
  26. package/dist/overlay2.js +16 -1
  27. package/dist/popover.js +11 -2
  28. package/dist/toast.css +21 -21
  29. package/dist/toast.js +10 -2
  30. package/dist/tooltip.js +12 -1
  31. package/dist/useFloatingPosition.js +16 -2
  32. package/dist/{useOverlayLayer.js → useOverlayZIndex.js} +29 -4
  33. package/docs/public-floating-api.md +24 -13
  34. package/docs/public-overlay-layer-api.md +65 -0
  35. package/docs/public-styles-api.md +1 -5
  36. package/package.json +38 -41
  37. package/dist/legacy-unlayered.css +0 -5382
@@ -49,19 +49,30 @@ const { actualPlacement, arrowStyle, floatingStyle } = useFloatingPosition({
49
49
 
50
50
  The composable accepts plain values, refs, computed refs or getters for reactive options.
51
51
 
52
- | Option | Default | Description |
53
- | ------------------ | ---------- | -------------------------------------------------------------- |
54
- | `reference` | required | Element or virtual element used as the anchor. |
55
- | `floating` | required | Floating HTML element. |
56
- | `arrow` | — | Optional arrow HTML element. |
57
- | `open` | `true` | Suspends positioning and auto-updates when false. |
58
- | `placement` | `bottom` | Preferred side and optional alignment. |
59
- | `strategy` | `absolute` | CSS positioning strategy: `absolute` or `fixed`. |
60
- | `offset` | `8` | Main/cross-axis distance from the reference. |
61
- | `flip` | `true` | Tries the opposite side when space is insufficient. |
62
- | `shift` | `true` | Keeps the floating element inside the collision boundary. |
63
- | `collisionPadding` | `8` | Padding between the floating element and viewport boundary. |
64
- | `restartKey` | — | Rebinds auto-update observers when its reactive value changes. |
52
+ | Option | Default | Description |
53
+ | ---------------------------------- | ---------- | ---------------------------------------------------------------------- |
54
+ | `reference` | required | Element or virtual element used as the anchor. |
55
+ | `floating` | required | Floating HTML element. |
56
+ | `arrow` | — | Optional arrow HTML element. |
57
+ | `open` | `true` | Suspends positioning and auto-updates when false. |
58
+ | `placement` | `bottom` | Preferred side and optional alignment. |
59
+ | `strategy` | `absolute` | CSS positioning strategy: `absolute` or `fixed`. |
60
+ | `offset` | `8` | Main/cross-axis distance from the reference. |
61
+ | `flip` | `true` | Tries the opposite side when space is insufficient. |
62
+ | `flipOptions.fallbackStrategy` | `bestFit` | Chooses the best fit or preserves the initial placement when none fit. |
63
+ | `shift` | `true` | Keeps the floating element inside the collision boundary. |
64
+ | `collisionPadding` | `8` | Padding between the floating element and viewport boundary. |
65
+ | `autoUpdateOptions.animationFrame` | `false` | Tracks transform animations and detached nested floating contexts. |
66
+ | `restartKey` | — | Rebinds auto-update observers when its reactive value changes. |
67
+
68
+ Use `autoUpdateOptions.animationFrame` sparingly. It checks the reference position every animation
69
+ frame and is intended for references moving with CSS transforms or nested floating elements outside
70
+ their ancestor's scrolling context. The animation-frame loop only runs while positioning is open.
71
+
72
+ `Popover`, `Tooltip`, `DropdownMenu`, `DropdownMenuContent` and `DropdownMenuSubContent` accept the
73
+ same `flipOptions` and `autoUpdateOptions` objects. On the data-driven `DropdownMenu`, the options
74
+ also apply to its open submenus. Each open floating element using `animationFrame: true` runs its own
75
+ animation-frame loop.
65
76
 
66
77
  The return value contains readonly `actualPlacement`, `floatingStyle`, `arrowStyle` and
67
78
  `isPositioned` refs, plus an async `update()` method for content-driven layout changes.
@@ -0,0 +1,65 @@
1
+ # Overlay layer z-index API
2
+
3
+ `OverlayLayerProvider` sets a shared z-index floor for Ropav portal surfaces in a Vue subtree.
4
+ Component props take precedence over the nearest provider, and components outside a provider keep
5
+ their existing defaults.
6
+
7
+ ```vue
8
+ <template>
9
+ <OverlayLayerProvider :base-z-index="5000">
10
+ <AppShell />
11
+ </OverlayLayerProvider>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { OverlayLayerProvider } from 'ropav/overlay';
16
+ </script>
17
+ ```
18
+
19
+ The provider follows the logical Vue component tree, including content rendered through
20
+ `Teleport`. Providers can be nested to create a higher or lower floor for one subtree.
21
+
22
+ ## Component overrides
23
+
24
+ `DialogRoot`, `Modal`, `Popover`, `DropdownMenu`, `DropdownMenuRoot`, `Tooltip` and `ToastViewport`
25
+ accept `baseZIndex`. The resolution order is:
26
+
27
+ 1. The component's `baseZIndex` prop.
28
+ 2. The nearest `OverlayLayerProvider`.
29
+ 3. The component's legacy default.
30
+
31
+ Dialog, Popover and Dropdown layers may end up above the resolved floor because active managed
32
+ layers are ordered in two-unit steps. The unused plane immediately below a Dialog content layer is
33
+ reserved for its overlay. A top-level Tooltip uses the resolved floor, while a Tooltip nested in a
34
+ managed layer uses at least `parentZIndex + 1`. `ToastViewport` applies an offset of `1`.
35
+
36
+ Without a provider or local override, Dropdown and Popover start at `100`, Dialog and Tooltip start
37
+ at `1000`, and ToastViewport uses `1001`.
38
+
39
+ ## Custom portal surfaces
40
+
41
+ `useOverlayZIndex()` lets custom portal content resolve the same policy without joining Ropav's
42
+ focus, inert, dismissal or active-layer management.
43
+
44
+ ```vue
45
+ <script setup lang="ts">
46
+ import { useOverlayZIndex } from 'ropav/overlay';
47
+
48
+ const props = defineProps<{ baseZIndex?: number }>();
49
+ const zIndex = useOverlayZIndex({
50
+ baseZIndex: () => props.baseZIndex,
51
+ defaultBaseZIndex: 1000,
52
+ offset: 1,
53
+ });
54
+ </script>
55
+ ```
56
+
57
+ | Option | Default | Description |
58
+ | ------------------- | ------- | ------------------------------------------------------------------- |
59
+ | `baseZIndex` | — | Local value, ref or getter that overrides the provider. |
60
+ | `defaultBaseZIndex` | `1000` | Fallback used when neither a local value nor provider is available. |
61
+ | `offset` | `0` | Value, ref or getter added to the resolved base. |
62
+ | `aboveParent` | `true` | Ensures the result is at least one plane above a parent layer. |
63
+
64
+ Set `aboveParent: false` when the custom surface only needs the resolved floor. The returned
65
+ `ComputedRef<number>` updates when the local value, provider or parent layer changes.
@@ -26,7 +26,7 @@ Ropav does not expose a `vars` prop. Public CSS variables are set through CSS, t
26
26
 
27
27
  - Classes merge as internal classes, compatibility classes, `classNames`, then root `class` attributes.
28
28
  - Styles merge as internal styles, compatibility styles, `styles`, then root `style` attributes. Later stages win a duplicate property.
29
- - `Card.bodyClass`, `inputAttrs` styling and `thumbStyle` are compatibility stages. `Card.bodyClass` is deprecated; the other escape hatches remain because they also carry non-styling behavior.
29
+ - `inputAttrs` styling and `thumbStyle` are compatibility stages because these escape hatches also carry non-styling behavior.
30
30
  - Attributes and native listeners are forwarded exactly once to the public root host. Internal native handlers run before consumer handlers.
31
31
  - Declared component events remain component events. Component-owned roles, ARIA and behavioral attributes remain authoritative.
32
32
  - Composite components do not copy root attributes into their child components. Teleported roots receive attributes on the rendered host, not on the virtual teleport node.
@@ -120,8 +120,6 @@ The layered stylesheet declares `ropav.tokens` before `ropav.components`. A laye
120
120
 
121
121
  Place global resets in `reset` and application overrides in `app`. Import order does not change precedence once the order is declared. Unlayered application rules still outrank named Ropav layers.
122
122
 
123
- Layer adoption changes cascade precedence. Consumers whose reset cannot yet be layered can temporarily import `ropav/legacy-unlayered.css` after that reset. The aggregate fallback is deprecated from its introduction and is intended only as a migration aid.
124
-
125
123
  ## Compatibility
126
124
 
127
125
  - Typed parts, state attributes, manifest entries, geometry variables and cascade layers form the current Public Styles API.
@@ -130,5 +128,3 @@ Layer adoption changes cascade precedence. Consumers whose reset cannot yet be l
130
128
  - `tokens:check` compares the current manifest with the latest reachable `v*` release tag that contains one. Until the first such release, it uses the immutable manifest from the initial Public Styles API commit (`f16e826`). Released variables cannot be removed, renamed or changed semantically; adding a variable requires incrementing the manifest's `contractVersion`.
131
129
  - Release tags must be available in the Git checkout that runs the check. `PUBLIC_STYLES_BASELINE_REF` can explicitly pin a commit or tag that contains a manifest.
132
130
  - Internal DOM, selectors and undocumented variables are outside the public contract.
133
- - `Card.bodyClass` is a deprecated compatibility escape hatch; prefer `classNames.body`.
134
- - The legacy unlayered stylesheet is a temporary migration fallback for consumers that cannot yet adopt cascade layers.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "ropav",
3
- "version": "0.0.12",
3
+ "version": "0.1.1",
4
+ "license": "MIT",
4
5
  "type": "module",
5
- "packageManager": "pnpm@11.10.0",
6
6
  "engines": {
7
7
  "node": "^20.19.0 || ^22.13.0 || >=24.0.0"
8
8
  },
@@ -164,42 +164,10 @@
164
164
  "import": "./dist/components/tooltip/index.js"
165
165
  },
166
166
  "./base.css": "./dist/base.css",
167
- "./legacy-unlayered.css": "./dist/legacy-unlayered.css",
168
167
  "./styles-manifest": "./src/styles/styles-manifest.json",
169
168
  "./styles-manifest.json": "./src/styles/styles-manifest.json",
170
169
  "./scss/*.scss": "./src/styles/*.scss"
171
170
  },
172
- "scripts": {
173
- "dev": "pnpm run storybook",
174
- "tokens:build": "style-dictionary build --config scripts/tokens.config.mjs --silent",
175
- "tokens:check": "node scripts/check-tokens.mjs",
176
- "styles:manifest:bootstrap": "node scripts/bootstrap-public-styles-manifest.mjs",
177
- "typecheck": "vue-tsc -b tsconfig.app.json tsconfig.node.json tsconfig.test.json",
178
- "typecheck:storybook": "vue-tsc -p tsconfig.storybook.json --noEmit",
179
- "lint": "oxlint",
180
- "lint:fix": "oxlint --fix",
181
- "format": "oxfmt",
182
- "format:check": "oxfmt --check",
183
- "test": "vitest run --project=unit",
184
- "test:consumer-types": "pnpm run test:package",
185
- "test:consumer-types:built": "tsc -p tests/fixtures/consumer-types/tsconfig.bundler.json && tsc -p tests/fixtures/consumer-types/tsconfig.nodenext.json",
186
- "test:exports": "pnpm run test:package",
187
- "test:exports:built": "node scripts/check-exports.mjs",
188
- "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",
189
- "test:package": "pnpm run build && pnpm run test:exports:built && pnpm run test:consumer-types:built && pnpm run test:consumer-fixture:built",
190
- "test:watch": "vitest --project=unit",
191
- "test:typecheck": "vitest run --project=unit --typecheck",
192
- "test:storybook": "vitest run --project=storybook",
193
- "test:all": "pnpm run tokens:check && pnpm test && pnpm test:storybook",
194
- "build": "pnpm run tokens:build && pnpm run tokens:check && pnpm run typecheck && vite build",
195
- "prepublishOnly": "pnpm run test:package",
196
- "preview": "vite preview",
197
- "storybook": "pnpm run tokens:build && storybook dev -p 6006 --no-open",
198
- "build-storybook": "pnpm run tokens:build && pnpm run tokens:check && pnpm run typecheck:storybook && storybook build",
199
- "changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -o CHANGELOG.md",
200
- "changelog:all": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -o CHANGELOG.md -r 0",
201
- "release": "pnpm run test:package && bumpp --git-check --all --commit \"chore(release): v%s\" --tag \"v%s\" --execute \"pnpm run changelog\""
202
- },
203
171
  "peerDependencies": {
204
172
  "vue": "^3.6.0-beta.4"
205
173
  },
@@ -209,9 +177,9 @@
209
177
  },
210
178
  "devDependencies": {
211
179
  "@iconify-json/lucide": "^1.2.117",
212
- "@storybook/addon-themes": "^10.5.0",
213
- "@storybook/addon-vitest": "^10.5.0",
214
- "@storybook/vue3-vite": "^10.5.0",
180
+ "@storybook/addon-themes": "^10.5.2",
181
+ "@storybook/addon-vitest": "^10.5.2",
182
+ "@storybook/vue3-vite": "^10.5.2",
215
183
  "@types/node": "^26.1.1",
216
184
  "@vitejs/plugin-vue": "^6.0.8",
217
185
  "@vitest/browser-playwright": "^4.1.10",
@@ -224,13 +192,12 @@
224
192
  "oxfmt": "^0.59.0",
225
193
  "oxlint": "^1.74.0",
226
194
  "playwright": "^1.61.1",
227
- "postcss": "^8.5.19",
228
195
  "sass-embedded": "^1.100.0",
229
- "storybook": "^10.5.0",
196
+ "storybook": "^10.5.2",
230
197
  "style-dictionary": "5.5.0",
231
198
  "typescript": "~6.0.3",
232
199
  "unplugin-icons": "^23.0.1",
233
- "vite": "^8.1.4",
200
+ "vite": "^8.1.5",
234
201
  "vite-plugin-dts": "^5.0.3",
235
202
  "vitest": "^4.1.10",
236
203
  "vue": "3.6.0-beta.17",
@@ -239,5 +206,35 @@
239
206
  "repository": {
240
207
  "type": "git",
241
208
  "url": "https://github.com/daopk/ropav"
209
+ },
210
+ "scripts": {
211
+ "dev": "pnpm run storybook",
212
+ "tokens:build": "style-dictionary build --config scripts/tokens.config.mjs --silent",
213
+ "tokens:check": "node scripts/check-tokens.mjs",
214
+ "styles:manifest:bootstrap": "node scripts/bootstrap-public-styles-manifest.mjs",
215
+ "typecheck": "vue-tsc -b tsconfig.app.json tsconfig.node.json tsconfig.test.json",
216
+ "typecheck:storybook": "vue-tsc -p tsconfig.storybook.json --noEmit",
217
+ "lint": "oxlint",
218
+ "lint:fix": "oxlint --fix",
219
+ "format": "oxfmt",
220
+ "format:check": "oxfmt --check",
221
+ "test": "vitest run --project=unit",
222
+ "test:consumer-types": "pnpm run test:package",
223
+ "test:consumer-types:built": "tsc -p tests/fixtures/consumer-types/tsconfig.bundler.json && tsc -p tests/fixtures/consumer-types/tsconfig.nodenext.json",
224
+ "test:exports": "pnpm run test:package",
225
+ "test:exports:built": "node scripts/check-exports.mjs",
226
+ "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",
227
+ "test:package": "pnpm run build && pnpm run test:exports:built && pnpm run test:consumer-types:built && pnpm run test:consumer-fixture:built",
228
+ "test:watch": "vitest --project=unit",
229
+ "test:typecheck": "vitest run --project=unit --typecheck",
230
+ "test:storybook": "vitest run --project=storybook",
231
+ "test:all": "pnpm run tokens:check && pnpm test && pnpm test:storybook",
232
+ "build": "pnpm run tokens:build && pnpm run tokens:check && pnpm run typecheck && vite build",
233
+ "preview": "vite preview",
234
+ "storybook": "pnpm run tokens:build && storybook dev -p 6006 --no-open",
235
+ "build-storybook": "pnpm run tokens:build && pnpm run tokens:check && pnpm run typecheck:storybook && storybook build",
236
+ "changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -o CHANGELOG.md",
237
+ "changelog:all": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -o CHANGELOG.md -r 0",
238
+ "release": "pnpm run test:package && bumpp --git-check --all --commit \"chore(release): v%s\" --tag \"v%s\" --execute \"pnpm run changelog\""
242
239
  }
243
- }
240
+ }