ropav 0.1.3 → 0.1.5
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 +16 -0
- package/dist/alert.css +18 -18
- package/dist/alert.js +15 -10
- package/dist/avatar.css +19 -19
- package/dist/avatar.js +14 -9
- package/dist/badge.css +16 -16
- package/dist/badge.js +12 -7
- package/dist/base.css +196 -56
- package/dist/button-link.css +32 -28
- package/dist/button-link.js +9 -5
- package/dist/button.css +32 -28
- package/dist/button.js +9 -5
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +17 -9
- package/dist/chevron-right.js +12 -0
- package/dist/collectionNavigation.js +120 -0
- package/dist/color-input.js +2 -1
- package/dist/componentColors.js +94 -22
- package/dist/components/alert/types.d.ts +1 -0
- package/dist/components/alert/useAlertColor.d.ts +1 -1
- package/dist/components/avatar/types.d.ts +1 -0
- package/dist/components/avatar/useAvatarColor.d.ts +1 -1
- package/dist/components/badge/types.d.ts +1 -0
- package/dist/components/badge/useBadgeColor.d.ts +1 -1
- package/dist/components/button/types.d.ts +1 -0
- package/dist/components/button/useButtonColor.d.ts +1 -1
- package/dist/components/button-link/types.d.ts +1 -0
- package/dist/components/checkbox/types.d.ts +1 -0
- package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +1 -0
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -2
- package/dist/components/dropdown-menu/index.d.ts +1 -0
- package/dist/components/dropdown-menu/types.d.ts +4 -0
- package/dist/components/dropdown-menu/useDropdownMenuInteractions.d.ts +2 -1
- package/dist/components/dropdown-menu/useDropdownMenuNavigation.d.ts +1 -0
- package/dist/components/icon-button/types.d.ts +1 -0
- package/dist/components/pagination/index.d.ts +4 -0
- package/dist/components/pagination/index.js +2 -0
- package/dist/components/pagination/pagination.d.ts +49 -0
- package/dist/components/pagination/types.d.ts +54 -0
- package/dist/components/pagination/usePagination.d.ts +19 -0
- package/dist/components/radio/types.d.ts +3 -0
- package/dist/components/scroll-area/scroll-area.d.ts +37 -3
- package/dist/components/scroll-area/types.d.ts +1 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +4 -0
- package/dist/components/scroll-area/useScrollAreaControls.d.ts +4 -0
- package/dist/components/scroll-area/useScrollAreaPresentation.d.ts +1 -1
- package/dist/components/select/useSelect.d.ts +1 -1
- package/dist/components/slider/range-slider-tooltip.d.ts +2 -0
- package/dist/components/slider/types.d.ts +1 -1
- package/dist/components/slider/useRangeSlider.d.ts +2 -0
- package/dist/components/slider/useSlider.d.ts +2 -0
- package/dist/components/toast/types.d.ts +2 -0
- package/dist/components/toast/useToastColor.d.ts +1 -1
- package/dist/components/tooltip/types.d.ts +1 -0
- package/dist/components/tooltip/useTooltip.d.ts +1 -1
- package/dist/dropdown-menu.js +55 -30
- package/dist/icon-button.css +39 -35
- package/dist/icon-button.js +9 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/input.js +2 -1
- package/dist/number-input.js +2 -1
- package/dist/pagination.css +140 -0
- package/dist/pagination.js +442 -0
- package/dist/radio.js +15 -5
- package/dist/scroll-area.css +25 -25
- package/dist/scroll-area.js +102 -19
- package/dist/select.js +65 -46
- package/dist/slider.css +191 -191
- package/dist/slider.js +49 -31
- package/dist/switch.js +2 -1
- package/dist/tabs.css +13 -13
- package/dist/tabs.js +38 -9
- package/dist/textarea.js +2 -1
- package/dist/toast.css +26 -26
- package/dist/toast.js +16 -9
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +13 -8
- package/dist/unplugin-icons.js +38 -25
- package/dist/useButtonColor.js +6 -3
- package/dist/useControllableValue.js +27 -0
- package/dist/useFormControl.js +2 -27
- package/dist/utils/componentColors.d.ts +14 -1
- package/docs/public-styles-api.md +1 -1
- package/docs/public-tokens.md +648 -508
- package/package.json +8 -2
- package/src/styles/_tokens.scss +459 -319
- package/src/styles/styles-manifest.json +1122 -2
package/dist/tooltip.js
CHANGED
|
@@ -66,12 +66,13 @@ function resolveTooltipOffsetStyle(offset) {
|
|
|
66
66
|
if (offset.crossAxis != null) style["--_rp-tooltip-cross-axis-offset"] = `${offset.crossAxis}px`;
|
|
67
67
|
return Object.keys(style).length > 0 ? style : void 0;
|
|
68
68
|
}
|
|
69
|
-
function resolveTooltipColorStyleWithContrast(color, autoContrast) {
|
|
69
|
+
function resolveTooltipColorStyleWithContrast(color, autoContrast, contrastColor) {
|
|
70
70
|
if (!color) return void 0;
|
|
71
71
|
const roles = getComponentVariantColorRoles({
|
|
72
72
|
color,
|
|
73
73
|
variant: "solid",
|
|
74
|
-
autoContrast
|
|
74
|
+
autoContrast,
|
|
75
|
+
contrastColor
|
|
75
76
|
});
|
|
76
77
|
if (!roles) return void 0;
|
|
77
78
|
return {
|
|
@@ -140,7 +141,7 @@ function useTooltip(props, emitOpenChange) {
|
|
|
140
141
|
const contentStyle = computed(() => ({
|
|
141
142
|
...floating.floatingStyle.value,
|
|
142
143
|
...resolveTooltipOffsetStyle(props.offset),
|
|
143
|
-
...resolveTooltipColorStyleWithContrast(props.color, props.autoContrast),
|
|
144
|
+
...resolveTooltipColorStyleWithContrast(props.color, props.autoContrast, props.contrastColor),
|
|
144
145
|
zIndex: zIndex.value
|
|
145
146
|
}));
|
|
146
147
|
function openTooltip() {
|
|
@@ -212,10 +213,10 @@ function useTooltip(props, emitOpenChange) {
|
|
|
212
213
|
}
|
|
213
214
|
//#endregion
|
|
214
215
|
//#region src/components/tooltip/tooltip.vue?vue&type=script&setup=true&vapor=true&lang.ts
|
|
215
|
-
var t0 = template("<span data-v-
|
|
216
|
+
var t0 = template("<span data-v-9457a843 class=rp-tooltip__arrow aria-hidden=true>");
|
|
216
217
|
var t1 = template(" ");
|
|
217
|
-
var t2 = template("<span data-v-
|
|
218
|
-
var t3 = template("<span data-v-
|
|
218
|
+
var t2 = template("<span data-v-9457a843>");
|
|
219
|
+
var t3 = template("<span data-v-9457a843>", 1);
|
|
219
220
|
//#endregion
|
|
220
221
|
//#region src/components/tooltip/tooltip.vue
|
|
221
222
|
var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineVaporComponent({
|
|
@@ -227,7 +228,11 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
227
228
|
baseZIndex: {},
|
|
228
229
|
content: { default: "" },
|
|
229
230
|
color: {},
|
|
230
|
-
autoContrast: {
|
|
231
|
+
autoContrast: {
|
|
232
|
+
type: Boolean,
|
|
233
|
+
default: true
|
|
234
|
+
},
|
|
235
|
+
contrastColor: {},
|
|
231
236
|
open: {
|
|
232
237
|
type: Boolean,
|
|
233
238
|
default: void 0
|
|
@@ -354,6 +359,6 @@ var tooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
|
|
|
354
359
|
setStaticTemplateRef(n14, rootRef, null, "rootRef");
|
|
355
360
|
return n14;
|
|
356
361
|
}
|
|
357
|
-
}), [["__scopeId", "data-v-
|
|
362
|
+
}), [["__scopeId", "data-v-9457a843"]]);
|
|
358
363
|
//#endregion
|
|
359
364
|
export { useDelayedOpen as i, resolveTooltipColorStyleWithContrast as n, resolveTooltipOffsetStyle as r, tooltip_default as t };
|
package/dist/unplugin-icons.js
CHANGED
|
@@ -1,39 +1,52 @@
|
|
|
1
1
|
import { compile } from "@vue/compiler-vapor";
|
|
2
2
|
//#region src/unplugin-icons.ts
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var ID_MAP_LOCAL = "__ropavIconIdMap";
|
|
4
|
+
var RANDOM_ID_LOCAL = "__ropavIconRandomId";
|
|
5
|
+
var RENDER_FUNCTION_START = "function render(_ctx) {";
|
|
6
|
+
var PAINT_SERVER_REFERENCE = /\b([\w-]+)="url\(#(.+?)\)"/g;
|
|
7
|
+
var SVG_ID_ATTRIBUTE = /\bid="(.+?)"/g;
|
|
8
|
+
function transformSvgIds(svg) {
|
|
9
|
+
if (!svg.includes("=\"url(#")) return {
|
|
6
10
|
svg,
|
|
7
|
-
|
|
11
|
+
renderLocals: ""
|
|
8
12
|
};
|
|
9
|
-
const
|
|
13
|
+
const referencedIds = /* @__PURE__ */ new Set();
|
|
14
|
+
const svgWithBoundReferences = svg.replace(PAINT_SERVER_REFERENCE, (_, attribute, id) => {
|
|
15
|
+
referencedIds.add(id);
|
|
16
|
+
return `:${attribute}="'url(#'+${ID_MAP_LOCAL}['${id}']+')'"`;
|
|
17
|
+
});
|
|
18
|
+
if (referencedIds.size === 0) return {
|
|
19
|
+
svg,
|
|
20
|
+
renderLocals: ""
|
|
21
|
+
};
|
|
22
|
+
const svgWithBoundIds = svgWithBoundReferences.replace(SVG_ID_ATTRIBUTE, (attribute, id) => referencedIds.has(id) ? `:id="${ID_MAP_LOCAL}['${id}']"` : attribute);
|
|
23
|
+
const idMapEntries = Array.from(referencedIds, (id) => `'${id}':'uicons-'+${RANDOM_ID_LOCAL}()`).join(",");
|
|
10
24
|
return {
|
|
11
|
-
svg:
|
|
12
|
-
|
|
13
|
-
return `:${attr}="'url(#'+idMap['${id}']+')'"`;
|
|
14
|
-
}).replace(/\bid="(.+?)"/g, (full, id) => {
|
|
15
|
-
if (idMap[id]) return `:id="idMap['${id}']"`;
|
|
16
|
-
return full;
|
|
17
|
-
}),
|
|
18
|
-
injectScripts: `${randomIdHelper}const idMap = {${Object.values(idMap).join(",")}};`
|
|
25
|
+
svg: svgWithBoundIds,
|
|
26
|
+
renderLocals: [`const ${RANDOM_ID_LOCAL} = () => Math.random().toString(36).slice(2, 12);`, `const ${ID_MAP_LOCAL} = {${idMapEntries}};`].join("\n ")
|
|
19
27
|
};
|
|
20
28
|
}
|
|
29
|
+
function injectRenderLocals(code, renderLocals) {
|
|
30
|
+
if (!renderLocals) return code;
|
|
31
|
+
if (!code.includes(RENDER_FUNCTION_START)) throw new Error("Unable to inject SVG ID bindings into the Vapor render function");
|
|
32
|
+
return code.replaceAll(`_ctx.${ID_MAP_LOCAL}`, ID_MAP_LOCAL).replace(RENDER_FUNCTION_START, `${RENDER_FUNCTION_START}\n ${renderLocals}`);
|
|
33
|
+
}
|
|
34
|
+
function createVaporIconModule(renderCode, componentName) {
|
|
35
|
+
return `${renderCode}
|
|
36
|
+
import { defineVaporComponent, markRaw } from 'vue';
|
|
37
|
+
|
|
38
|
+
export default markRaw(defineVaporComponent({ name: ${JSON.stringify(componentName)}, render }))
|
|
39
|
+
/* vite-plugin-components disabled */`;
|
|
40
|
+
}
|
|
21
41
|
/** An unplugin-icons compiler that emits zero-VDOM Vue Vapor components. */
|
|
22
42
|
function vaporIconCompiler() {
|
|
23
43
|
return { compiler(svg, collection, icon) {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
filename: `${
|
|
44
|
+
const componentName = `${collection}-${icon}`;
|
|
45
|
+
const transformed = transformSvgIds(svg);
|
|
46
|
+
return createVaporIconModule(injectRenderLocals(compile(transformed.svg, {
|
|
47
|
+
filename: `${componentName}.vue`,
|
|
28
48
|
prefixIdentifiers: true
|
|
29
|
-
});
|
|
30
|
-
code = code.replace(/^export /gm, "");
|
|
31
|
-
const setup = injectScripts ? `,\n setup() {${injectScripts};return { idMap }}` : "";
|
|
32
|
-
return `${code}
|
|
33
|
-
import { defineVaporComponent, markRaw } from 'vue';
|
|
34
|
-
|
|
35
|
-
export default markRaw(defineVaporComponent({ name: ${JSON.stringify(name)}, render${setup} }))
|
|
36
|
-
/* vite-plugin-components disabled */`;
|
|
49
|
+
}).code.replace(/^export /gm, ""), transformed.renderLocals), componentName);
|
|
37
50
|
} };
|
|
38
51
|
}
|
|
39
52
|
//#endregion
|
package/dist/useButtonColor.js
CHANGED
|
@@ -11,12 +11,13 @@ var loader_circle_default = markRaw(defineVaporComponent({
|
|
|
11
11
|
}));
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/components/button/useButtonColor.ts
|
|
14
|
-
function getButtonColorStyle(color, variant, autoContrast) {
|
|
14
|
+
function getButtonColorStyle(color, variant, autoContrast, contrastColor) {
|
|
15
15
|
if (!color && !variant) return void 0;
|
|
16
16
|
const roles = getComponentVariantColorRoles({
|
|
17
17
|
color,
|
|
18
18
|
variant,
|
|
19
|
-
autoContrast
|
|
19
|
+
autoContrast,
|
|
20
|
+
contrastColor
|
|
20
21
|
});
|
|
21
22
|
if (!roles) return void 0;
|
|
22
23
|
return {
|
|
@@ -26,7 +27,9 @@ function getButtonColorStyle(color, variant, autoContrast) {
|
|
|
26
27
|
"--_rp-button-border": roles.border,
|
|
27
28
|
"--_rp-button-border-hover": roles.borderHover,
|
|
28
29
|
"--_rp-button-border-active": roles.borderActive,
|
|
29
|
-
"--_rp-button-fg": roles.color
|
|
30
|
+
"--_rp-button-fg": roles.color,
|
|
31
|
+
"--_rp-button-fg-hover": roles.colorHover,
|
|
32
|
+
"--_rp-button-fg-active": roles.colorActive
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
//#endregion
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { computed, shallowRef, watch } from "vue";
|
|
2
|
+
//#region src/composables/useControllableValue.ts
|
|
3
|
+
function useControllableValue(options) {
|
|
4
|
+
const initialValue = options.defaultValue();
|
|
5
|
+
const uncontrolledValue = shallowRef(initialValue);
|
|
6
|
+
const isControlled = computed(() => options.modelValue() !== void 0);
|
|
7
|
+
watch(options.modelValue, (value) => {
|
|
8
|
+
if (value !== void 0) uncontrolledValue.value = value;
|
|
9
|
+
}, { immediate: true });
|
|
10
|
+
const value = computed(() => options.modelValue() ?? uncontrolledValue.value);
|
|
11
|
+
function setValue(nextValue) {
|
|
12
|
+
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
13
|
+
options.onChange(nextValue);
|
|
14
|
+
}
|
|
15
|
+
function resetValue(nextValue = initialValue) {
|
|
16
|
+
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
initialValue,
|
|
20
|
+
isControlled,
|
|
21
|
+
value,
|
|
22
|
+
setValue,
|
|
23
|
+
resetValue
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useControllableValue as t };
|
package/dist/useFormControl.js
CHANGED
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/composables/useControllableValue.ts
|
|
3
|
-
function useControllableValue(options) {
|
|
4
|
-
const initialValue = options.defaultValue();
|
|
5
|
-
const uncontrolledValue = shallowRef(initialValue);
|
|
6
|
-
const isControlled = computed(() => options.modelValue() !== void 0);
|
|
7
|
-
watch(options.modelValue, (value) => {
|
|
8
|
-
if (value !== void 0) uncontrolledValue.value = value;
|
|
9
|
-
}, { immediate: true });
|
|
10
|
-
const value = computed(() => options.modelValue() ?? uncontrolledValue.value);
|
|
11
|
-
function setValue(nextValue) {
|
|
12
|
-
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
13
|
-
options.onChange(nextValue);
|
|
14
|
-
}
|
|
15
|
-
function resetValue(nextValue = initialValue) {
|
|
16
|
-
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
initialValue,
|
|
20
|
-
isControlled,
|
|
21
|
-
value,
|
|
22
|
-
setValue,
|
|
23
|
-
resetValue
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
1
|
+
import { inject, provide, watchEffect } from "vue";
|
|
27
2
|
//#region src/composables/useFormControl.ts
|
|
28
3
|
var nestedFormControlOwnerKey = Symbol("nestedFormControlOwner");
|
|
29
4
|
function provideNestedFormControlOwner() {
|
|
@@ -104,4 +79,4 @@ function useCheckedFormControl(element, controllable, validationMessage) {
|
|
|
104
79
|
});
|
|
105
80
|
}
|
|
106
81
|
//#endregion
|
|
107
|
-
export { useTextFormControl as a, useFormControl as i, provideNestedFormControlOwner as n,
|
|
82
|
+
export { useTextFormControl as a, useFormControl as i, provideNestedFormControlOwner as n, useCheckedFormControl as r, claimNestedFormControlOwner as t };
|
|
@@ -10,6 +10,8 @@ export interface ComponentColorRoles {
|
|
|
10
10
|
hover: string;
|
|
11
11
|
active: string;
|
|
12
12
|
contrast: string;
|
|
13
|
+
contrastHover: string;
|
|
14
|
+
contrastActive: string;
|
|
13
15
|
light: string;
|
|
14
16
|
lightHover: string;
|
|
15
17
|
lightActive: string;
|
|
@@ -22,12 +24,22 @@ export interface ComponentVariantColorRoles {
|
|
|
22
24
|
hover: string;
|
|
23
25
|
active: string;
|
|
24
26
|
color: string;
|
|
27
|
+
colorHover: string;
|
|
28
|
+
colorActive: string;
|
|
25
29
|
border: string;
|
|
26
30
|
borderHover: string;
|
|
27
31
|
borderActive: string;
|
|
28
32
|
}
|
|
29
33
|
export interface ComponentContrastColorOptions {
|
|
34
|
+
/** Automatically selects a readable foreground for preset and opaque custom colors. */
|
|
30
35
|
autoContrast?: boolean;
|
|
36
|
+
/** Required when an automatically contrasted custom color is translucent. */
|
|
37
|
+
contrastColor?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ComponentContrastColorRoles {
|
|
40
|
+
color: string;
|
|
41
|
+
hover: string;
|
|
42
|
+
active: string;
|
|
31
43
|
}
|
|
32
44
|
export interface ComponentVariantColorOptions extends ComponentContrastColorOptions {
|
|
33
45
|
color: ComponentColorValue | undefined;
|
|
@@ -56,5 +68,6 @@ export declare function isComponentPresetColor(color: ComponentColorValue | unde
|
|
|
56
68
|
export declare function parseComponentColor(color: ComponentColorValue | undefined): ParsedComponentColor;
|
|
57
69
|
export declare function getComponentColorValue(color: ComponentColorValue | undefined): string | undefined;
|
|
58
70
|
export declare function getComponentContrastColor(color: ComponentColorValue | undefined, options?: ComponentContrastColorOptions): string;
|
|
71
|
+
export declare function getComponentContrastColorRoles(color: ComponentColorValue | undefined, options?: ComponentContrastColorOptions): ComponentContrastColorRoles;
|
|
59
72
|
export declare function getComponentColorRoles(color: ComponentColorValue | undefined): ComponentColorRoles | undefined;
|
|
60
|
-
export declare function getComponentVariantColorRoles({ color, variant, defaultColor, autoContrast, }: ComponentVariantColorOptions): ComponentVariantColorRoles | undefined;
|
|
73
|
+
export declare function getComponentVariantColorRoles({ color, variant, defaultColor, autoContrast, contrastColor, }: ComponentVariantColorOptions): ComponentVariantColorRoles | undefined;
|
|
@@ -111,7 +111,7 @@ The exact entries in [`styles-manifest.json`](../src/styles/styles-manifest.json
|
|
|
111
111
|
|
|
112
112
|
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).
|
|
113
113
|
|
|
114
|
-
Palette shades and their `*-contrast` companions are required override groups because `autoContrast` consumes
|
|
114
|
+
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.
|
|
115
115
|
|
|
116
116
|
## Cascade layers and migration
|
|
117
117
|
|