@sewadah/selaras 0.6.0 → 0.7.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 (36) hide show
  1. package/dist/agent/catalog.json +1 -1
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/NavigationMenu.d.vue.ts +7 -1
  4. package/dist/runtime/components/NavigationMenu.vue +19 -8
  5. package/dist/runtime/components/NavigationMenu.vue.d.ts +7 -1
  6. package/dist/runtime/components/NavigationMenuAccordionItem.vue +2 -2
  7. package/dist/runtime/components/NavigationMenuFlyoutList.vue +2 -2
  8. package/dist/runtime/components/NavigationMenuFlyoutTrigger.vue +1 -1
  9. package/dist/runtime/components/ProsePre.d.vue.ts +2 -2
  10. package/dist/runtime/components/ProsePre.vue +13 -6
  11. package/dist/runtime/components/ProsePre.vue.d.ts +2 -2
  12. package/dist/runtime/components/SplitterPanel.vue +29 -3
  13. package/dist/runtime/components/Stepper.d.vue.ts +5 -0
  14. package/dist/runtime/components/Stepper.vue +12 -0
  15. package/dist/runtime/components/Stepper.vue.d.ts +5 -0
  16. package/dist/runtime/components/Table.vue +6 -1
  17. package/dist/runtime/internal/stepper-root-element.d.ts +5 -0
  18. package/dist/runtime/internal/stepper-root-element.js +8 -0
  19. package/dist/runtime/prose.css +1 -1
  20. package/dist/runtime/structural.css +1 -1
  21. package/dist/runtime/theme/navigation-menu.d.ts +18 -0
  22. package/dist/runtime/theme/navigation-menu.js +21 -28
  23. package/dist/runtime/theme/prose.d.ts +3 -0
  24. package/dist/runtime/theme/prose.js +7 -6
  25. package/dist/runtime/theme/stepper.d.ts +3 -0
  26. package/dist/runtime/theme/stepper.js +1 -0
  27. package/dist/runtime/theme/table.d.ts +6 -3
  28. package/dist/runtime/theme/table.js +5 -3
  29. package/dist/runtime/theme-config.d.ts +1 -1
  30. package/dist/runtime/types/index.d.ts +1 -1
  31. package/dist/runtime/utils/file-icons.js +1 -0
  32. package/dist/runtime/utils/messages.d.ts +4 -0
  33. package/dist/runtime/utils/messages.js +4 -0
  34. package/dist/runtime/utils/navigation-menu.d.ts +10 -0
  35. package/dist/runtime/utils/navigation-menu.js +25 -0
  36. package/package.json +3 -3
@@ -1,16 +1,8 @@
1
1
  import { tv } from "tailwind-variants";
2
2
  export const navigationMenuTheme = tv({
3
3
  slots: {
4
- // w-full - without it, Root shrink-wraps to just its own trigger
5
- // buttons' natural width inside whatever flex/grid container it sits
6
- // in (confirmed: inside the docs site's own demo wrapper, a bare
7
- // `flex` nav ended up narrower than its own dropdown content). Since
8
- // `viewport` below is sized `w-full` *relative to Root*, a narrow
9
- // Root clipped any dropdown content wider than the nav's own row -
10
- // visible as text cut off mid-word in a custom-content example wider
11
- // than the default trigger row. A real navbar spans its container's
12
- // width anyway (the standard pattern), so this is correct regardless
13
- // of the clipping bug it also happens to fix.
4
+ // Keep the full navigation width available for wide panels. Compact
5
+ // panels measure their content and follow the active trigger instead.
14
6
  root: "flex w-full",
15
7
  list: "flex list-none",
16
8
  item: "min-w-0",
@@ -62,28 +54,19 @@ export const navigationMenuTheme = tv({
62
54
  // link's, so a "Links"-style heading sits flush with the real items
63
55
  // below it.
64
56
  groupLabel: "px-2.5 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-[var(--selaras-resolved-text-muted)] first:pt-0",
57
+ collapsedGroupLabel: "sr-only",
58
+ groupSpacer: "h-2",
65
59
  separator: "my-1 h-px bg-[var(--selaras-resolved-border-default)]"
66
60
  },
67
61
  variants: {
62
+ contentOrientation: {
63
+ horizontal: {},
64
+ vertical: {}
65
+ },
68
66
  orientation: {
69
- // `content`: full width of the nav bar, not sized to its own
70
- // content - confirmed directly against two comparable references
71
- // (one's own real theme sizes this `w-full`; the other's own
72
- // mega-menu-style wide panel component - not its own separate
73
- // narrow cascading-submenu component - does the same). Each open
74
- // item's own panel stacks absolutely inside the shared viewport
75
- // (only one visible via Presence), rather than sizing the
76
- // viewport to whichever is active.
77
- // `childList`: adaptive column count (not a fixed grid-cols-2 like
78
- // a comparable reference's own default) - a fixed count leaves an
79
- // awkward empty cell for an odd number of children. `auto-fit`,
80
- // not `auto-fill` - fill reserves empty phantom tracks for
81
- // however many columns WOULD fit the container width, leaving
82
- // that much dead space when there are fewer actual children than
83
- // that - exactly what showed up as a wide empty gap next to a
84
- // 4-item grid in a very wide panel. `auto-fit` collapses those
85
- // phantom tracks to 0 instead, so existing children always
86
- // stretch to fill the full width.
67
+ // Wide panels fill the navigation bar. Auto-fit collapses unused
68
+ // columns so the links fill the available space. The compact-content
69
+ // compound variant below replaces the width and column count.
87
70
  horizontal: {
88
71
  root: "relative items-center",
89
72
  list: "items-center gap-1",
@@ -190,6 +173,15 @@ export const navigationMenuTheme = tv({
190
173
  }
191
174
  },
192
175
  compoundVariants: [
176
+ {
177
+ orientation: "horizontal",
178
+ contentOrientation: "vertical",
179
+ class: {
180
+ content: "inset-x-auto left-0 w-[min(20rem,calc(100vw-1.25rem))]",
181
+ viewport: "inset-x-auto left-[var(--reka-navigation-menu-viewport-left)] w-[var(--reka-navigation-menu-viewport-width)]",
182
+ childList: "grid-cols-1"
183
+ }
184
+ },
193
185
  { variant: "pill", active: false, class: { link: "hover:bg-[var(--selaras-resolved-surface-elevated)]", childLink: "hover:bg-[var(--selaras-resolved-surface-elevated)]" } },
194
186
  // All registered non-neutral roles use the selected semantic recipe.
195
187
  // Neutral follows these entries so its functional-token classes win via
@@ -215,6 +207,7 @@ export const navigationMenuTheme = tv({
215
207
  ],
216
208
  defaultVariants: {
217
209
  orientation: "horizontal",
210
+ contentOrientation: "vertical",
218
211
  color: "primary",
219
212
  variant: "pill"
220
213
  }
@@ -21,6 +21,7 @@ export declare const proseTheme: import("tailwind-variants").TVReturnType<{
21
21
  preLabel: string;
22
22
  preIcon: string;
23
23
  preFilename: string;
24
+ preLanguage: string;
24
25
  preCopyButton: string;
25
26
  pre: string;
26
27
  }, undefined, {
@@ -46,6 +47,7 @@ export declare const proseTheme: import("tailwind-variants").TVReturnType<{
46
47
  preLabel: string;
47
48
  preIcon: string;
48
49
  preFilename: string;
50
+ preLanguage: string;
49
51
  preCopyButton: string;
50
52
  pre: string;
51
53
  }, import("tailwind-variants").TVReturnTypeLike<{
@@ -71,6 +73,7 @@ export declare const proseTheme: import("tailwind-variants").TVReturnType<{
71
73
  preLabel: string;
72
74
  preIcon: string;
73
75
  preFilename: string;
76
+ preLanguage: string;
74
77
  preCopyButton: string;
75
78
  pre: string;
76
79
  }>>;
@@ -8,13 +8,14 @@ export const proseTheme = tv({
8
8
  h5: "text-base font-semibold text-[var(--selaras-resolved-text-default)] scroll-mt-20",
9
9
  h6: "text-sm font-semibold text-[var(--selaras-resolved-text-default)] scroll-mt-20",
10
10
  headingAnchor: "no-underline hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--_selaras-color-focus)]",
11
- preWrapper: "overflow-hidden rounded-[var(--selaras-resolved-radius-md)] ring-1 ring-[var(--selaras-resolved-border-default)]",
12
- preHeader: "flex items-center justify-between gap-2 border-b border-[var(--selaras-resolved-border-default)] bg-[var(--selaras-resolved-surface-elevated)] px-3 py-1.5",
13
- preLabel: "flex min-w-0 items-center gap-2",
14
- preIcon: "size-4",
15
- preFilename: "font-mono text-xs text-[var(--selaras-resolved-text-muted)]",
11
+ preWrapper: "min-w-0 overflow-hidden rounded-[var(--selaras-resolved-radius-lg)] bg-[var(--selaras-resolved-surface-elevated)] ring-1 ring-[var(--selaras-resolved-border-default)]",
12
+ preHeader: "flex min-h-11 items-center justify-between gap-3 border-b border-[var(--selaras-resolved-border-default)] bg-[var(--selaras-resolved-surface-default)] px-4 py-1.5",
13
+ preLabel: "flex min-w-0 items-center gap-2.5",
14
+ preIcon: "size-4 shrink-0",
15
+ preFilename: "truncate font-mono text-xs font-medium text-[var(--selaras-resolved-text-default)]",
16
+ preLanguage: "truncate font-mono text-xs text-[var(--selaras-resolved-text-muted)]",
16
17
  preCopyButton: "shrink-0",
17
- pre: "overflow-x-auto bg-[var(--selaras-resolved-surface-elevated)] p-4 font-mono text-sm leading-relaxed"
18
+ pre: "m-0 overflow-x-auto rounded-none bg-[var(--selaras-resolved-surface-elevated)] p-4 font-mono text-sm leading-relaxed text-[var(--selaras-resolved-text-default)]"
18
19
  },
19
20
  variants: {
20
21
  color: {
@@ -40,6 +40,7 @@ export declare const stepperTheme: import("tailwind-variants").TVReturnType<{
40
40
  warning: "";
41
41
  };
42
42
  }, {
43
+ progress: string;
43
44
  root: string;
44
45
  item: string;
45
46
  connector: string;
@@ -92,6 +93,7 @@ export declare const stepperTheme: import("tailwind-variants").TVReturnType<{
92
93
  warning: "";
93
94
  };
94
95
  }, {
96
+ progress: string;
95
97
  root: string;
96
98
  item: string;
97
99
  connector: string;
@@ -144,6 +146,7 @@ export declare const stepperTheme: import("tailwind-variants").TVReturnType<{
144
146
  warning: "";
145
147
  };
146
148
  }, {
149
+ progress: string;
147
150
  root: string;
148
151
  item: string;
149
152
  connector: string;
@@ -1,6 +1,7 @@
1
1
  import { tv } from "tailwind-variants";
2
2
  export const stepperTheme = tv({
3
3
  slots: {
4
+ progress: "sr-only",
4
5
  root: "flex w-full items-start",
5
6
  // flex-1 (not sized to its own content) - items sit edge-to-edge with
6
7
  // no gap between them so the separator living inside the *current*
@@ -24,9 +24,10 @@ export declare const tableTheme: import("tailwind-variants").TVReturnType<{
24
24
  };
25
25
  gridlines: {
26
26
  true: {
27
- table: string;
27
+ thead: string;
28
28
  th: string;
29
29
  td: string;
30
+ tfoot: string;
30
31
  };
31
32
  };
32
33
  striped: {
@@ -100,9 +101,10 @@ export declare const tableTheme: import("tailwind-variants").TVReturnType<{
100
101
  };
101
102
  gridlines: {
102
103
  true: {
103
- table: string;
104
+ thead: string;
104
105
  th: string;
105
106
  td: string;
107
+ tfoot: string;
106
108
  };
107
109
  };
108
110
  striped: {
@@ -176,9 +178,10 @@ export declare const tableTheme: import("tailwind-variants").TVReturnType<{
176
178
  };
177
179
  gridlines: {
178
180
  true: {
179
- table: string;
181
+ thead: string;
180
182
  th: string;
181
183
  td: string;
184
+ tfoot: string;
182
185
  };
183
186
  };
184
187
  striped: {
@@ -54,9 +54,11 @@ export const tableTheme = tv({
54
54
  },
55
55
  gridlines: {
56
56
  true: {
57
- table: "border border-[var(--selaras-resolved-border-default)]",
58
- th: "border border-[var(--selaras-resolved-border-default)]",
59
- td: "border border-[var(--selaras-resolved-border-default)]"
57
+ // The wrapper supplies the outer frame, including empty and scrolling states.
58
+ thead: "[&>tr>th]:border-b",
59
+ th: "border-e border-[var(--selaras-resolved-border-default)] data-[last-column]:border-e-0",
60
+ td: "border-e border-[var(--selaras-resolved-border-default)] last:border-e-0",
61
+ tfoot: "border-t border-[var(--selaras-resolved-border-default)]"
60
62
  }
61
63
  },
62
64
  striped: {
@@ -334,7 +334,7 @@ export interface ThemeComponentRegistry {
334
334
  /** Shared by the public component and its recursive accordion/flyout renderers. */
335
335
  navigationMenu: {
336
336
  slots: NavigationMenuThemeSlots;
337
- conditions: WithRegisteredColor<Pick<NavigationMenuVariants, 'orientation' | 'color' | 'variant' | 'active' | 'disabled' | 'highlight' | 'collapsed' | 'flyoutRoot'>>;
337
+ conditions: WithRegisteredColor<Pick<NavigationMenuVariants, 'orientation' | 'contentOrientation' | 'color' | 'variant' | 'active' | 'disabled' | 'highlight' | 'collapsed' | 'flyoutRoot'>>;
338
338
  };
339
339
  /** Page controls are Button recipes; this key owns wrapper and ellipsis layout. */
340
340
  pagination: {
@@ -100,7 +100,7 @@ export type { IconRegistry } from '../utils/icons.js';
100
100
  export { defaultIcons } from '../utils/icons.js';
101
101
  export type { MessageRegistry } from '../utils/messages.js';
102
102
  export { defaultMessages } from '../utils/messages.js';
103
- export type { NavigationMenuItem } from '../utils/navigation-menu.js';
103
+ export type { NavigationMenuItem, NavigationMenuPopover, NavigationMenuPositioning } from '../utils/navigation-menu.js';
104
104
  export type { ContextMenuPositioning, OverlayPortal, OverlayPositioning } from '../utils/overlay.js';
105
105
  export type { SelectGroup, SelectIdentity, SelectModel, SelectModelValue, SelectResolvedOption, SelectValue } from '../utils/select-contracts.js';
106
106
  export type { TableEmits, TableProps, TableSlots } from '../utils/table-contracts.js';
@@ -1,5 +1,6 @@
1
1
  export const defaultFileIcons = {
2
2
  "vue": "vscode-icons:file-type-vue",
3
+ "vue-html": "vscode-icons:file-type-vue",
3
4
  "ts": "vscode-icons:file-type-typescript",
4
5
  "typescript": "vscode-icons:file-type-typescript",
5
6
  "mts": "vscode-icons:file-type-typescript",
@@ -18,6 +18,8 @@ export interface MessageRegistry {
18
18
  first: string;
19
19
  last: string;
20
20
  pagination: string;
21
+ stepper: string;
22
+ stepperProgress: (step: number, total: number) => string;
21
23
  scrollTabsLeft: string;
22
24
  scrollTabsRight: string;
23
25
  datePicker: string;
@@ -55,6 +57,8 @@ export interface MessageRegistry {
55
57
  avatarGroupOverflow: (count: number) => string;
56
58
  paginationInfo: (page: number, total: number) => string;
57
59
  codeTabFallback: (index: number) => string;
60
+ copyCode: string;
61
+ codeCopied: string;
58
62
  dropFiles: string;
59
63
  invalidFileType: (name: string) => string;
60
64
  invalidFileSize: (name: string, max: string) => string;
@@ -18,6 +18,8 @@ export const defaultMessages = {
18
18
  first: "First",
19
19
  last: "Last",
20
20
  pagination: "Pagination",
21
+ stepper: "Progress",
22
+ stepperProgress: (step, total) => `Step ${step} of ${total}`,
21
23
  scrollTabsLeft: "Scroll tabs left",
22
24
  scrollTabsRight: "Scroll tabs right",
23
25
  datePicker: "Date picker",
@@ -54,6 +56,8 @@ export const defaultMessages = {
54
56
  avatarGroupOverflow: (count) => `+${count}`,
55
57
  paginationInfo: (page, total) => `Page ${page} of ${total}`,
56
58
  codeTabFallback: (index) => `Tab ${index}`,
59
+ copyCode: "Copy code",
60
+ codeCopied: "Copied!",
57
61
  dropFiles: "Drop files here or click to browse",
58
62
  invalidFileType: (name) => `${name}: invalid file type`,
59
63
  invalidFileSize: (name, max) => `${name}: exceeds the ${max} size limit`,
@@ -1,7 +1,10 @@
1
1
  import type { PopoverProps } from '../components/Popover.vue.js';
2
2
  import type { TooltipProps } from '../components/Tooltip.vue.js';
3
3
  import type { HotkeyOptions } from '../directives/hotkey.js';
4
+ import type { OverlayPositioning } from './overlay.js';
4
5
  export type NavigationMenuPopover = Pick<PopoverProps, 'side' | 'align' | 'positioning' | 'portal' | 'arrow' | 'ui'>;
6
+ /** Alignment of a horizontal navigation menu's compact dropdown. */
7
+ export type NavigationMenuPositioning = Pick<OverlayPositioning, 'align'>;
5
8
  export interface NavigationMenuItem {
6
9
  label: string;
7
10
  icon?: string;
@@ -47,3 +50,10 @@ export interface NavigationMenuItem {
47
50
  export declare function isNavigationMenuItemActive(item: NavigationMenuItem, currentPath: string): boolean;
48
51
  /** The v-hotkey binding for an item that opts in with `hotkey: true`. */
49
52
  export declare function navigationMenuHotkey(item: NavigationMenuItem): HotkeyOptions | undefined;
53
+ interface CollapsedNavigationMenuEntry {
54
+ item: NavigationMenuItem;
55
+ boundary: false | 'separator' | 'spacing';
56
+ }
57
+ /** Defer a boundary until the next action, avoiding edge and repeated dividers. */
58
+ export declare function collapsedNavigationMenuEntries(items: NavigationMenuItem[], presentation: 'separator' | 'spacing' | 'none'): CollapsedNavigationMenuEntry[];
59
+ export {};
@@ -6,3 +6,28 @@ export function isNavigationMenuItemActive(item, currentPath) {
6
6
  export function navigationMenuHotkey(item) {
7
7
  return item.hotkey && item.shortcut && !item.disabled ? { keys: item.shortcut } : void 0;
8
8
  }
9
+ export function collapsedNavigationMenuEntries(items, presentation) {
10
+ const entries = [];
11
+ let hasAction = false;
12
+ let groupBoundary = false;
13
+ let explicitBoundary = false;
14
+ for (const item of items) {
15
+ if (item.type === "separator") {
16
+ explicitBoundary = hasAction;
17
+ continue;
18
+ }
19
+ if (item.type === "label") {
20
+ entries.push({ item, boundary: false });
21
+ groupBoundary = hasAction;
22
+ continue;
23
+ }
24
+ const boundary = explicitBoundary ? "separator" : groupBoundary && presentation !== "none" ? presentation : false;
25
+ if (boundary)
26
+ entries.push({ item: { label: item.label, type: "separator" }, boundary });
27
+ entries.push({ item, boundary: false });
28
+ hasAction = true;
29
+ groupBoundary = false;
30
+ explicitBoundary = false;
31
+ }
32
+ return entries;
33
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sewadah/selaras",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.7.1",
5
5
  "description": "A UI component library for Nuxt, built on Reka UI and Tailwind v4",
6
6
  "author": "Wicaksana Pratama <wicaksanapratama@gmail.com>",
7
7
  "license": "MIT",
@@ -111,9 +111,9 @@
111
111
  "dev:preview": "bunx nuxt preview docs",
112
112
  "dev:prepare": "bun run docs:prepare",
113
113
  "docs:build": "nuxt build docs",
114
- "docs:dev": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare packages/docs/preview && nuxt dev packages/docs/preview",
114
+ "docs:dev": "nuxt-module-build build --stub && bun run scripts/sync-workspace-dist.mjs && nuxt-module-build prepare && nuxt prepare packages/docs/preview && nuxt dev packages/docs/preview",
115
115
  "docs:generate": "nuxt generate docs",
116
- "docs:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare docs && bun run scripts/sync-workspace-dist.mjs",
116
+ "docs:prepare": "nuxt-module-build build --stub && bun run scripts/sync-workspace-dist.mjs && nuxt-module-build prepare && nuxt prepare docs",
117
117
  "docs:types": "cd docs && vue-tsc --noEmit",
118
118
  "release": "bun run release:both",
119
119
  "release:both": "bun run release:selaras && bun run release:docs",