bootstrap-vue-next
Version:
Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development
222 lines (221 loc) • 7.56 kB
JavaScript
require("./chunk-CoQrYLCe.js");
const require_dist = require("./dist-BJ15ThEs.js");
let vue = require("vue");
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/shared/createContext.js
/**
* @param providerComponentName - The name(s) of the component(s) providing the context.
*
* There are situations where context can come from multiple components. In such cases, you might need to give an array of component names to provide your context, instead of just a single string.
*
* @param contextName The description for injection key symbol.
*/
function createContext(providerComponentName, contextName) {
const symbolDescription = typeof providerComponentName === "string" && !contextName ? `${providerComponentName}Context` : contextName;
const injectionKey = Symbol(symbolDescription);
/**
* @param fallback The context value to return if the injection fails.
*
* @throws When context injection failed and no fallback is specified.
* This happens when the component injecting the context is not a child of the root component providing the context.
*/
const injectContext = (fallback) => {
const context = (0, vue.inject)(injectionKey, fallback);
if (context) return context;
if (context === null) return context;
throw new Error(`Injection \`${injectionKey.toString()}\` not found. Component must be used within ${Array.isArray(providerComponentName) ? `one of the following components: ${providerComponentName.join(", ")}` : `\`${providerComponentName}\``}`);
};
const provideContext = (contextValue) => {
(0, vue.provide)(injectionKey, contextValue);
return contextValue;
};
return [injectContext, provideContext];
}
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/shared/renderSlotFragments.js
function renderSlotFragments(children) {
if (!children) return [];
return children.flatMap((child) => {
if (child.type === vue.Fragment) return renderSlotFragments(child.children);
return [child];
});
}
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/ConfigProvider/ConfigProvider.js
var [injectConfigProviderContext, provideConfigProviderContext] = createContext("ConfigProvider");
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/shared/useDirection.js
/**
* The `useDirection` function provides a way to access the current direction in your application.
* @param {Ref<Direction | undefined>} [dir] - An optional ref containing the direction (ltr or rtl).
* @returns computed value that combines with the resolved direction.
*/
function useDirection(dir) {
const context = injectConfigProviderContext({ dir: (0, vue.ref)("ltr") });
return (0, vue.computed)(() => dir?.value || context.dir?.value || "ltr");
}
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/Primitive/Slot.js
var Slot = (0, vue.defineComponent)({
name: "PrimitiveSlot",
inheritAttrs: false,
setup(_, { attrs, slots }) {
return () => {
if (!slots.default) return null;
const children = renderSlotFragments(slots.default());
const firstNonCommentChildrenIndex = children.findIndex((child) => child.type !== vue.Comment);
if (firstNonCommentChildrenIndex === -1) return children;
const firstNonCommentChildren = children[firstNonCommentChildrenIndex];
delete firstNonCommentChildren.props?.ref;
const mergedProps = firstNonCommentChildren.props ? (0, vue.mergeProps)(attrs, firstNonCommentChildren.props) : attrs;
const cloned = (0, vue.cloneVNode)({
...firstNonCommentChildren,
props: {}
}, mergedProps);
if (children.length === 1) return cloned;
children[firstNonCommentChildrenIndex] = cloned;
return children;
};
}
});
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/Primitive/Primitive.js
var SELF_CLOSING_TAGS = [
"area",
"img",
"input"
];
var Primitive = (0, vue.defineComponent)({
name: "Primitive",
inheritAttrs: false,
props: {
asChild: {
type: Boolean,
default: false
},
as: {
type: [String, Object],
default: "div"
}
},
setup(props, { attrs, slots }) {
const asTag = props.asChild ? "template" : props.as;
if (typeof asTag === "string" && SELF_CLOSING_TAGS.includes(asTag)) return () => (0, vue.h)(asTag, attrs);
if (asTag !== "template") return () => (0, vue.h)(props.as, attrs, { default: slots.default });
return () => (0, vue.h)(Slot, attrs, { default: slots.default });
}
});
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/Primitive/usePrimitiveElement.js
function usePrimitiveElement() {
const primitiveElement = (0, vue.ref)();
return {
primitiveElement,
currentElement: (0, vue.computed)(() => ["#text", "#comment"].includes(primitiveElement.value?.$el.nodeName) ? primitiveElement.value?.$el.nextElementSibling : require_dist.unrefElement(primitiveElement))
};
}
//#endregion
//#region ../../node_modules/.pnpm/reka-ui@2.9.2_vue@3.5.31_typescript@5.9.3_/node_modules/reka-ui/dist/VisuallyHidden/VisuallyHidden.js
var VisuallyHidden_default = /* @__PURE__ */ (0, vue.defineComponent)({
__name: "VisuallyHidden",
props: {
feature: {
type: String,
required: false,
default: "focusable"
},
asChild: {
type: Boolean,
required: false
},
as: {
type: null,
required: false,
default: "span"
}
},
setup(__props) {
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(Primitive), {
as: _ctx.as,
"as-child": _ctx.asChild,
"aria-hidden": _ctx.feature === "focusable" ? "true" : void 0,
"data-hidden": _ctx.feature === "fully-hidden" ? "" : void 0,
tabindex: _ctx.feature === "fully-hidden" ? "-1" : void 0,
style: {
position: "absolute",
border: 0,
width: "1px",
height: "1px",
padding: 0,
margin: "-1px",
overflow: "hidden",
clip: "rect(0, 0, 0, 0)",
clipPath: "inset(50%)",
whiteSpace: "nowrap",
wordWrap: "normal",
top: "-1px",
left: "-1px"
}
}, {
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
_: 3
}, 8, [
"as",
"as-child",
"aria-hidden",
"data-hidden",
"tabindex"
]);
};
}
});
//#endregion
Object.defineProperty(exports, "Primitive", {
enumerable: true,
get: function() {
return Primitive;
}
});
Object.defineProperty(exports, "Slot", {
enumerable: true,
get: function() {
return Slot;
}
});
Object.defineProperty(exports, "VisuallyHidden_default", {
enumerable: true,
get: function() {
return VisuallyHidden_default;
}
});
Object.defineProperty(exports, "createContext", {
enumerable: true,
get: function() {
return createContext;
}
});
Object.defineProperty(exports, "injectConfigProviderContext", {
enumerable: true,
get: function() {
return injectConfigProviderContext;
}
});
Object.defineProperty(exports, "renderSlotFragments", {
enumerable: true,
get: function() {
return renderSlotFragments;
}
});
Object.defineProperty(exports, "useDirection", {
enumerable: true,
get: function() {
return useDirection;
}
});
Object.defineProperty(exports, "usePrimitiveElement", {
enumerable: true,
get: function() {
return usePrimitiveElement;
}
});
//# sourceMappingURL=VisuallyHidden-DaN947I0.js.map