@sewadah/selaras 0.3.1 → 0.4.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 +10 -1
- package/agent/catalog.mjs +73 -0
- package/agent/mcp.mjs +15 -0
- package/agent/server.mjs +58 -0
- package/dist/agent/catalog.json +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -5
- package/dist/runtime/components/AlertDialog.d.vue.ts +5 -3
- package/dist/runtime/components/AlertDialog.vue +17 -9
- package/dist/runtime/components/AlertDialog.vue.d.ts +5 -3
- package/dist/runtime/components/App.vue +2 -0
- package/dist/runtime/components/Autocomplete.d.vue.ts +2 -2
- package/dist/runtime/components/Autocomplete.vue +1 -1
- package/dist/runtime/components/Autocomplete.vue.d.ts +2 -2
- package/dist/runtime/components/Button.d.vue.ts +7 -5
- package/dist/runtime/components/Button.vue +14 -3
- package/dist/runtime/components/Button.vue.d.ts +7 -5
- package/dist/runtime/components/ColorModeSwitch.d.vue.ts +18 -0
- package/dist/runtime/components/ColorModeSwitch.vue +59 -0
- package/dist/runtime/components/ColorModeSwitch.vue.d.ts +18 -0
- package/dist/runtime/components/ConfirmRenderer.d.vue.ts +3 -0
- package/dist/runtime/components/ConfirmRenderer.vue +39 -0
- package/dist/runtime/components/ConfirmRenderer.vue.d.ts +3 -0
- package/dist/runtime/components/ContextMenu.vue +4 -2
- package/dist/runtime/components/Drawer.vue +3 -2
- package/dist/runtime/components/Dropdown.vue +4 -2
- package/dist/runtime/components/Modal.vue +3 -2
- package/dist/runtime/components/Popover.vue +4 -2
- package/dist/runtime/components/Select.d.vue.ts +8 -4
- package/dist/runtime/components/Select.vue +1 -1
- package/dist/runtime/components/Select.vue.d.ts +8 -4
- package/dist/runtime/components/Slideover.vue +3 -2
- package/dist/runtime/components/Tooltip.vue +4 -2
- package/dist/runtime/composables/use-confirm.d.ts +14 -0
- package/dist/runtime/composables/use-confirm.js +28 -0
- package/dist/runtime/internal/ComboboxSelectBase.d.vue.ts +41 -32
- package/dist/runtime/internal/ComboboxSelectBase.vue +154 -68
- package/dist/runtime/internal/ComboboxSelectBase.vue.d.ts +41 -32
- package/dist/runtime/internal/ComboboxSelectBody.d.vue.ts +9 -7
- package/dist/runtime/internal/ComboboxSelectBody.vue +6 -6
- package/dist/runtime/internal/ComboboxSelectBody.vue.d.ts +9 -7
- package/dist/runtime/internal/combobox-select.d.ts +19 -18
- package/dist/runtime/internal/combobox-select.js +36 -14
- package/dist/runtime/internal/programmatic-services.d.ts +11 -0
- package/dist/runtime/internal/programmatic-services.js +1 -0
- package/dist/runtime/theme/badge.d.ts +9 -0
- package/dist/runtime/theme/badge.js +2 -1
- package/dist/runtime/theme/button.d.ts +18 -0
- package/dist/runtime/theme/button.js +4 -1
- package/dist/runtime/theme/select.js +1 -4
- package/dist/runtime/theme/toast.js +1 -1
- package/dist/runtime/theme-config.d.ts +1 -1
- package/dist/runtime/types/index.d.ts +4 -1
- package/dist/runtime/utils/autocomplete-contracts.d.ts +4 -4
- package/dist/runtime/utils/file-icons.js +1 -0
- package/dist/runtime/utils/messages.d.ts +1 -0
- package/dist/runtime/utils/messages.js +1 -0
- package/dist/runtime/utils/select-contracts.d.ts +18 -10
- package/dist/runtime/utils/ui.d.ts +11 -0
- package/dist/runtime/utils/ui.js +54 -1
- package/package.json +19 -9
- package/skills/selaras/SKILL.md +40 -0
- package/skills/selaras/agents/openai.yaml +4 -0
package/dist/runtime/utils/ui.js
CHANGED
|
@@ -53,6 +53,13 @@ export function useRootProps(slotFn, override, options) {
|
|
|
53
53
|
resolveSlot(slotFn(), withFallthroughClass(options?.includeClass === false ? void 0 : fallthroughClass.value, override()))
|
|
54
54
|
));
|
|
55
55
|
}
|
|
56
|
+
export function useFallthroughProps(override) {
|
|
57
|
+
const { fallthroughClass, attrsWithoutClass } = useRootFallthrough();
|
|
58
|
+
return computed(() => mergeProps(
|
|
59
|
+
attrsWithoutClass.value,
|
|
60
|
+
resolveSlot((options) => options?.class ?? "", withFallthroughClass(fallthroughClass.value, override?.()))
|
|
61
|
+
));
|
|
62
|
+
}
|
|
56
63
|
export function useFallthroughAttrs(select) {
|
|
57
64
|
const attrs = useAttrs();
|
|
58
65
|
return computed(() => Object.fromEntries(
|
|
@@ -78,7 +85,53 @@ export function useComponentTheme(key, base) {
|
|
|
78
85
|
result = tv({ extend: result, ...globalOverride });
|
|
79
86
|
for (const override of collectThemeChain(themeContext?.value, (c) => c.ui, key))
|
|
80
87
|
result = tv({ extend: result, ...override });
|
|
81
|
-
return result;
|
|
88
|
+
return withVariantFallback(result, key);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const warnedThemeValues = /* @__PURE__ */ new Set();
|
|
92
|
+
export function withVariantFallback(theme, key) {
|
|
93
|
+
return new Proxy(theme, {
|
|
94
|
+
apply(target, thisArg, args) {
|
|
95
|
+
const supplied = args[0];
|
|
96
|
+
if (!supplied || typeof supplied !== "object")
|
|
97
|
+
return Reflect.apply(target, thisArg, args);
|
|
98
|
+
let resolved;
|
|
99
|
+
for (const axis of ["variant", "size"]) {
|
|
100
|
+
const value = supplied[axis];
|
|
101
|
+
if (value === void 0)
|
|
102
|
+
continue;
|
|
103
|
+
const values = target.variants?.[axis];
|
|
104
|
+
if (!values)
|
|
105
|
+
continue;
|
|
106
|
+
const accepted = new Set(Object.keys(values));
|
|
107
|
+
for (const compound of target.compoundVariants ?? []) {
|
|
108
|
+
const condition = compound[axis];
|
|
109
|
+
if (Array.isArray(condition)) {
|
|
110
|
+
for (const entry of condition)
|
|
111
|
+
accepted.add(String(entry));
|
|
112
|
+
} else if (condition !== void 0) {
|
|
113
|
+
accepted.add(String(condition));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (accepted.has(String(value)))
|
|
117
|
+
continue;
|
|
118
|
+
const defaults = target.defaultVariants;
|
|
119
|
+
const fallback = defaults?.[axis];
|
|
120
|
+
resolved ??= { ...supplied };
|
|
121
|
+
resolved[axis] = fallback;
|
|
122
|
+
if (import.meta.dev) {
|
|
123
|
+
const signature = `${key}:${axis}:${String(value)}`;
|
|
124
|
+
if (!warnedThemeValues.has(signature)) {
|
|
125
|
+
warnedThemeValues.add(signature);
|
|
126
|
+
const component = `${key[0]?.toUpperCase() ?? ""}${key.slice(1)}`;
|
|
127
|
+
const values2 = [...accepted].join(", ");
|
|
128
|
+
const fallbackMessage = fallback === void 0 ? "the default styling" : `"${String(fallback)}"`;
|
|
129
|
+
console.warn(`[Selaras ${component}] Unknown ${axis} "${String(value)}"; using ${fallbackMessage}. Valid values: ${values2}.`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return Reflect.apply(target, thisArg, resolved ? [resolved, ...args.slice(1)] : args);
|
|
134
|
+
}
|
|
82
135
|
});
|
|
83
136
|
}
|
|
84
137
|
export function useThemeProps(key) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sewadah/selaras",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"import": "./dist/runtime/theme-api.js"
|
|
46
46
|
},
|
|
47
47
|
"./components/DrawerRenderer*": {},
|
|
48
|
+
"./components/ConfirmRenderer*": {},
|
|
48
49
|
"./components/ModalRenderer*": {},
|
|
49
50
|
"./components/NavigationMenuAccordionItem*": {},
|
|
50
51
|
"./components/NavigationMenuFlyoutList*": {},
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
"./dist/runtime/theme-api.d.ts"
|
|
77
78
|
],
|
|
78
79
|
"components/DrawerRenderer*": [],
|
|
80
|
+
"components/ConfirmRenderer*": [],
|
|
79
81
|
"components/ModalRenderer*": [],
|
|
80
82
|
"components/NavigationMenuAccordionItem*": [],
|
|
81
83
|
"components/NavigationMenuFlyoutList*": [],
|
|
@@ -86,8 +88,13 @@
|
|
|
86
88
|
]
|
|
87
89
|
}
|
|
88
90
|
},
|
|
91
|
+
"bin": {
|
|
92
|
+
"selaras-mcp": "agent/mcp.mjs"
|
|
93
|
+
},
|
|
89
94
|
"files": [
|
|
90
|
-
"
|
|
95
|
+
"agent",
|
|
96
|
+
"dist",
|
|
97
|
+
"skills"
|
|
91
98
|
],
|
|
92
99
|
"engines": {
|
|
93
100
|
"node": "^22.19.0 || ^24.11.0 || >=26.0.0"
|
|
@@ -98,18 +105,16 @@
|
|
|
98
105
|
],
|
|
99
106
|
"scripts": {
|
|
100
107
|
"prepack": "nuxt-module-build build",
|
|
101
|
-
"dev": "bun run docs:dev",
|
|
108
|
+
"dev": "bun run docs:prepare && nuxt dev docs",
|
|
102
109
|
"dev:build": "bun run docs:build",
|
|
103
110
|
"dev:generate": "bun run docs:generate",
|
|
104
111
|
"dev:preview": "bunx nuxt preview docs",
|
|
105
112
|
"dev:prepare": "bun run docs:prepare",
|
|
106
113
|
"docs:build": "nuxt build docs",
|
|
107
|
-
"docs:dev": "
|
|
114
|
+
"docs:dev": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare packages/docs/preview && nuxt dev packages/docs/preview",
|
|
108
115
|
"docs:generate": "nuxt generate docs",
|
|
109
116
|
"docs:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare docs && bun run scripts/sync-workspace-dist.mjs",
|
|
110
117
|
"docs:types": "cd docs && vue-tsc --noEmit",
|
|
111
|
-
"docs-template:dev": "bun run docs-template:prepare && nuxt dev packages/docs/preview",
|
|
112
|
-
"docs-template:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare packages/docs/preview",
|
|
113
118
|
"release": "bun run release:both",
|
|
114
119
|
"release:both": "bun run release:selaras && bun run release:docs",
|
|
115
120
|
"release:selaras": "bun run lint && bun run test && (if [ -n \"$RELEASE_VERSION\" ]; then npx changelogen --bump -r \"$RELEASE_VERSION\"; elif [ \"${RELEASE_BUMP:-auto}\" = \"auto\" ]; then npx changelogen --bump; else npx changelogen --bump \"--$RELEASE_BUMP\"; fi) && bun run test:release && npm publish --access public && bash scripts/tag-and-push-release.sh selaras && changelogen gh release",
|
|
@@ -124,7 +129,9 @@
|
|
|
124
129
|
"test:watch": "vitest watch",
|
|
125
130
|
"test:types": "vue-tsc --noEmit && bun run docs:types",
|
|
126
131
|
"tokens:check": "node scripts/generate-default-colors.mjs --check",
|
|
127
|
-
"tokens:generate": "node scripts/generate-default-colors.mjs"
|
|
132
|
+
"tokens:generate": "node scripts/generate-default-colors.mjs",
|
|
133
|
+
"agent:build": "node scripts/build-agent-catalog.mjs",
|
|
134
|
+
"test:agent": "node scripts/test-agent-support.mjs"
|
|
128
135
|
},
|
|
129
136
|
"peerDependencies": {
|
|
130
137
|
"nuxt": "^4.5.2",
|
|
@@ -132,6 +139,7 @@
|
|
|
132
139
|
},
|
|
133
140
|
"dependencies": {
|
|
134
141
|
"@internationalized/date": "^3.5.0",
|
|
142
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
135
143
|
"@nuxt/icon": "^1.10.3",
|
|
136
144
|
"@nuxt/kit": "^4.5.2",
|
|
137
145
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
@@ -143,7 +151,8 @@
|
|
|
143
151
|
"shiki": "^4.4.3",
|
|
144
152
|
"tailwind-merge": "^3.6.0",
|
|
145
153
|
"tailwind-variants": "^3.3.1",
|
|
146
|
-
"tw-animate-css": "^1.4.0"
|
|
154
|
+
"tw-animate-css": "^1.4.0",
|
|
155
|
+
"zod": "^4.6.5"
|
|
147
156
|
},
|
|
148
157
|
"devDependencies": {
|
|
149
158
|
"@antfu/eslint-config": "^9.3.0",
|
|
@@ -162,6 +171,7 @@
|
|
|
162
171
|
"typescript": "^6.0.3",
|
|
163
172
|
"vee-validate": "4",
|
|
164
173
|
"vitest": "^4.1.10",
|
|
165
|
-
"vue-tsc": "^3.3.9"
|
|
174
|
+
"vue-tsc": "^3.3.9",
|
|
175
|
+
"yaml": "^2.9.0"
|
|
166
176
|
}
|
|
167
177
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: selaras
|
|
3
|
+
description: Build and customize Vue and Nuxt interfaces with @sewadah/selaras. Use when a project uses Selaras or the user asks to adopt it, including component selection, forms, overlays, theming, icons, localization, and adaptive interfaces.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Selaras
|
|
7
|
+
|
|
8
|
+
Use the existing Selaras catalog to compose the requested interface. Check documentation before assuming a component is missing or inventing its props. Preserve the application's design and the user's scope.
|
|
9
|
+
|
|
10
|
+
## Find the right component
|
|
11
|
+
|
|
12
|
+
If a Selaras MCP connection is available, start with `list_components` or `search_documentation`, then use `get_documentation` and `get_example` for matching APIs and examples. Its offline catalog follows the installed package version. Tools retrieve documentation; use the user's requirements to decide which components fit. Do not assume a missing MCP connection prevents the task.
|
|
13
|
+
|
|
14
|
+
Without MCP, read the [documentation index](https://sewadahapp.github.io/selaras/llms.txt), then retrieve the relevant Markdown guides through its links. Each guide includes component contracts and Vue example source. Prefer targeted pages over loading `llms-full.txt` for every task.
|
|
15
|
+
|
|
16
|
+
If the project has Selaras installed, inspect its package version and existing Nuxt configuration first. Published web documentation may describe a newer version; confirm uncertain APIs against installed public types. Component names below use the default `S` prefix; the application can configure another prefix.
|
|
17
|
+
|
|
18
|
+
Look beyond Button and Input when choosing components:
|
|
19
|
+
|
|
20
|
+
- Forms: Select, Autocomplete, InputNumber, DatePicker, ColorPicker, Checkbox, Switch, RadioGroup, Form, and FormField.
|
|
21
|
+
- Actions and search: Dropdown, ContextMenu, NavigationMenu, CommandPalette, Kbd, and the hotkey directive.
|
|
22
|
+
- Data and feedback: Table, Timeline, Tree, Pagination, Alert, Toast, and Skeleton.
|
|
23
|
+
- Overlays: Modal, AlertDialog, Drawer, Slideover, Popover, and Tooltip; inspect programmatic composables when the interaction calls for them.
|
|
24
|
+
- Layout and content: App, Container, Header, Card, Tabs, Accordion, ScrollArea, Dashboard components, and documentation composites.
|
|
25
|
+
|
|
26
|
+
These are discovery hints, not substitute API definitions. Read the matching catalog entry and a relevant example before implementing. Build a custom component when documented components do not fit the requirement.
|
|
27
|
+
|
|
28
|
+
## Integration and customization
|
|
29
|
+
|
|
30
|
+
For a new integration, read [Installation](https://sewadahapp.github.io/selaras/raw/overview/getting-started/installation.md) and [Nuxt configuration](https://sewadahapp.github.io/selaras/raw/overview/getting-started/nuxt-configuration.md). Existing projects may already have providers and styles configured; inspect before changing them.
|
|
31
|
+
|
|
32
|
+
- `SApp` supplies shared providers. Toast and CommandPalette still require the documented mounted components.
|
|
33
|
+
- Use supported props for behavior and appearance, slots for custom content, `class` for the root, and `ui` for documented component parts.
|
|
34
|
+
- Read [Theming](https://sewadahapp.github.io/selaras/raw/overview/theming/overview.md) for CSS tokens, global `app.config.selaras.ui` and defaults, or scoped `STheme`. Do not invent slot names or assume every prop has a global default.
|
|
35
|
+
- Read [Icons](https://sewadahapp.github.io/selaras/raw/overview/getting-started/icons.md) for Nuxt Icon loading and configuration. Internal icon purposes use `app.config.selaras.icons`; explicitly supplied icons remain local.
|
|
36
|
+
- Read [Messages](https://sewadahapp.github.io/selaras/raw/overview/getting-started/messages.md) for internal text and accessible labels. The formatting locale and translated messages are separate settings.
|
|
37
|
+
- Read [Color modes](https://sewadahapp.github.io/selaras/raw/overview/theming/color-modes.md) for light, dark, and system preferences. Documentation showcase themes are not automatically installed application presets.
|
|
38
|
+
- Read [Adaptive interfaces](https://sewadahapp.github.io/selaras/raw/overview/getting-started/adaptive-interfaces.md) before opting supported controls into mobile modal presentation. `adaptive` is opt-in, not a universal component prop.
|
|
39
|
+
|
|
40
|
+
Match item shapes, model values, and selection events to the component contract. Preserve accessible names, keyboard behavior, focus restoration, and form associations when customizing slots. Validate interactions relevant to the change in the project's normal checks, including mobile presentation when enabled.
|