createSimpleFunctional.mjs 900 B

123456789101112131415161718192021222324252627282930
  1. // Composables
  2. import { makeComponentProps } from "../composables/component.mjs"; // Utilities
  3. import { camelize, capitalize, h } from 'vue';
  4. import { genericComponent } from "./defineComponent.mjs";
  5. export function createSimpleFunctional(klass) {
  6. let tag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'div';
  7. let name = arguments.length > 2 ? arguments[2] : undefined;
  8. return genericComponent()({
  9. name: name ?? capitalize(camelize(klass.replace(/__/g, '-'))),
  10. props: {
  11. tag: {
  12. type: String,
  13. default: tag
  14. },
  15. ...makeComponentProps()
  16. },
  17. setup(props, _ref) {
  18. let {
  19. slots
  20. } = _ref;
  21. return () => {
  22. return h(props.tag, {
  23. class: [klass, props.class],
  24. style: props.style
  25. }, slots.default?.());
  26. };
  27. }
  28. });
  29. }
  30. //# sourceMappingURL=createSimpleFunctional.mjs.map