ropav 0.1.4 → 0.1.6
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 +20 -0
- package/dist/accordion.js +11 -8
- package/dist/alert.css +18 -18
- package/dist/alert.js +27 -21
- package/dist/avatar.css +19 -19
- package/dist/avatar.js +16 -11
- package/dist/badge.css +16 -16
- package/dist/badge.js +14 -9
- package/dist/base.css +214 -69
- package/dist/button-group.js +1 -1
- package/dist/button-link.js +16 -14
- package/dist/button.css +37 -28
- package/dist/button.js +16 -14
- package/dist/{useButtonColor.js → button.scss_vue_type_style_index_0_src_true_lang.js} +8 -4
- package/dist/card.js +1 -1
- package/dist/checkbox.css +32 -32
- package/dist/checkbox.js +19 -11
- package/dist/chevron-right.js +12 -0
- package/dist/collapse.css +6 -6
- package/dist/collapse.js +4 -4
- package/dist/collectionNavigation.js +120 -0
- package/dist/color-input.css +19 -19
- package/dist/color-input.js +6 -5
- package/dist/color-picker.css +7 -7
- package/dist/color-picker.js +4 -5
- package/dist/color-swatch.js +1 -1
- package/dist/componentColors.js +135 -23
- 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/checkbox/useCheckbox.d.ts +1 -1
- package/dist/components/color-input/color-input.d.ts +2 -2
- package/dist/components/color-input/useColorInput.d.ts +1 -1
- package/dist/components/dialog/dialog-core.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-primitive-core.d.ts +2 -1
- package/dist/components/dropdown-menu/dropdown-menu-sub-content.d.ts +2 -2
- package/dist/components/dropdown-menu/dropdown-menu-utils.d.ts +0 -2
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +3 -3
- 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/useDropdownMenuDisclosure.d.ts +3 -4
- 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/input/useInput.d.ts +1 -1
- package/dist/components/number-input/useNumberInput.d.ts +1 -1
- 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/progress/useProgress.d.ts +1 -1
- package/dist/components/radio/types.d.ts +3 -0
- package/dist/components/radio/useRadio.d.ts +2 -2
- package/dist/components/scroll-area/scrollAreaCore.d.ts +5 -0
- package/dist/components/scroll-area/types.d.ts +4 -0
- package/dist/components/scroll-area/useScrollArea.d.ts +1 -0
- package/dist/components/scroll-area/useScrollAreaMetrics.d.ts +3 -0
- package/dist/components/scroll-area/useScrollAreaPresentation.d.ts +3 -0
- package/dist/components/select/useSelect.d.ts +3 -2
- package/dist/components/select/useSelectNativeValue.d.ts +1 -7
- package/dist/components/slider/range-slider-tooltip.d.ts +2 -0
- package/dist/components/slider/sliderCore.d.ts +2 -1
- package/dist/components/slider/types.d.ts +1 -1
- package/dist/components/slider/useRangeSlider.d.ts +3 -1
- package/dist/components/slider/useSlider.d.ts +3 -1
- package/dist/components/switch/useSwitch.d.ts +1 -1
- package/dist/components/textarea/useTextarea.d.ts +1 -1
- 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/composables/index.d.ts +2 -0
- package/dist/composables/index.js +2 -0
- package/dist/composables/useControllableValue.d.ts +14 -0
- package/dist/dialog.js +8 -5
- package/dist/dropdown-menu.js +98 -59
- package/dist/field.js +1 -1
- package/dist/floating.js +19 -7
- package/dist/icon-button.css +12 -169
- package/dist/icon-button.js +11 -7
- package/dist/index.d.ts +6 -4
- package/dist/index.js +8 -5
- package/dist/input.css +24 -24
- package/dist/input.js +6 -5
- package/dist/modal.js +11 -7
- package/dist/number-input.css +18 -18
- package/dist/number-input.js +8 -7
- package/dist/overlay.js +1 -1
- package/dist/pagination.css +140 -0
- package/dist/pagination.js +442 -0
- package/dist/popover.js +9 -6
- package/dist/progress.css +29 -21
- package/dist/progress.js +17 -10
- package/dist/radio.js +17 -7
- package/dist/scroll-area.css +10 -1
- package/dist/scroll-area.js +82 -25
- package/dist/select.css +45 -45
- package/dist/select.js +111 -70
- package/dist/slider.css +191 -191
- package/dist/slider.js +58 -46
- package/dist/switch.css +17 -17
- package/dist/switch.js +7 -6
- package/dist/tabs.css +3 -3
- package/dist/tabs.js +25 -15
- package/dist/textarea.css +26 -26
- package/dist/textarea.js +5 -4
- package/dist/toast.css +26 -26
- package/dist/toast.js +35 -23
- package/dist/tooltip.css +12 -12
- package/dist/tooltip.js +24 -16
- package/dist/unplugin-icons.js +38 -25
- package/dist/useCollapse.js +12 -7
- package/dist/useControlState.js +1 -1
- package/dist/useControllableValue.js +33 -0
- package/dist/useFloatingPosition.js +4 -1140
- package/dist/useFormControl.js +5 -29
- package/dist/useOverlayZIndex.js +1 -1
- package/dist/useRequiredInject.js +1 -1
- package/dist/utils/componentColors.d.ts +14 -1
- package/docs/public-composables-api.md +52 -0
- package/docs/public-styles-api.md +1 -1
- package/docs/public-tokens.md +648 -508
- package/package.json +49 -36
- package/src/styles/_mixins.scss +4 -0
- package/src/styles/_tokens.scss +460 -320
- package/src/styles/_variables.scss +1 -1
- package/src/styles/styles-manifest.json +1122 -2
- package/dist/button-link.css +0 -163
- /package/dist/{composables → internal/composables}/useOverlayLayer.d.ts +0 -0
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/useCollapse.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { t as useControllableValue } from "./useControllableValue.js";
|
|
1
2
|
import { t as bem } from "./bem.js";
|
|
2
|
-
import { computed,
|
|
3
|
+
import { computed, toValue, useId } from "vue";
|
|
3
4
|
//#region src/components/collapse/useCollapse.ts
|
|
4
5
|
var DEFAULT_ROLE = "region";
|
|
5
6
|
function optionValue(value) {
|
|
@@ -7,11 +8,17 @@ function optionValue(value) {
|
|
|
7
8
|
}
|
|
8
9
|
function useCollapse(options = {}, emitOpenChange) {
|
|
9
10
|
const generatedId = useId();
|
|
10
|
-
const uncontrolledOpen = ref(false);
|
|
11
11
|
const id = computed(() => optionValue(options.id) ?? `${generatedId}-collapse`);
|
|
12
|
-
const controlledOpen = computed(() => optionValue(options.open));
|
|
13
12
|
const isDisabled = computed(() => Boolean(optionValue(options.disabled)));
|
|
14
|
-
const
|
|
13
|
+
const controllableOpen = useControllableValue({
|
|
14
|
+
modelValue: () => optionValue(options.open),
|
|
15
|
+
defaultValue: () => false,
|
|
16
|
+
onChange: (nextOpen) => {
|
|
17
|
+
options.onOpenChange?.(nextOpen);
|
|
18
|
+
emitOpenChange?.(nextOpen);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const isOpen = controllableOpen.value;
|
|
15
22
|
const state = computed(() => isOpen.value ? "open" : "closed");
|
|
16
23
|
const shouldRenderContent = computed(() => !optionValue(options.unmountOnExit) || isOpen.value);
|
|
17
24
|
const rootClass = computed(() => bem("rp-collapse", {
|
|
@@ -54,9 +61,7 @@ function useCollapse(options = {}, emitOpenChange) {
|
|
|
54
61
|
}));
|
|
55
62
|
function setOpen(nextOpen) {
|
|
56
63
|
if (isDisabled.value || nextOpen === isOpen.value) return;
|
|
57
|
-
|
|
58
|
-
options.onOpenChange?.(nextOpen);
|
|
59
|
-
emitOpenChange?.(nextOpen);
|
|
64
|
+
controllableOpen.setValue(nextOpen);
|
|
60
65
|
}
|
|
61
66
|
function open() {
|
|
62
67
|
setOpen(true);
|
package/dist/useControlState.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
-
//#region src/composables/useControlState.ts
|
|
2
|
+
//#region src/internal/composables/useControlState.ts
|
|
3
3
|
function mergeIds(...values) {
|
|
4
4
|
const ids = values.flatMap((value) => value?.split(/\s+/) ?? []).filter(Boolean);
|
|
5
5
|
return ids.length > 0 ? Array.from(new Set(ids)).join(" ") : void 0;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
}, {
|
|
10
|
+
flush: "sync",
|
|
11
|
+
immediate: true
|
|
12
|
+
});
|
|
13
|
+
const value = computed(() => {
|
|
14
|
+
const modelValue = options.modelValue();
|
|
15
|
+
return modelValue === void 0 ? uncontrolledValue.value : modelValue;
|
|
16
|
+
});
|
|
17
|
+
function setValue(nextValue) {
|
|
18
|
+
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
19
|
+
options.onChange(nextValue);
|
|
20
|
+
}
|
|
21
|
+
function resetValue(nextValue = initialValue) {
|
|
22
|
+
if (!isControlled.value) uncontrolledValue.value = nextValue;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
initialValue,
|
|
26
|
+
isControlled,
|
|
27
|
+
value,
|
|
28
|
+
setValue,
|
|
29
|
+
resetValue
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { useControllableValue as t };
|