Skip to content
On this page

@obewds/vue-component-helpers Component

ES Module Version

ESM version

js
import { emptyElementTags as a, unsupportedElementTags as u } from "@obewds/vue-validators";
import m from "deepmerge";
import { ObewdsTwConfig as p } from "@obewds/obewds-tw-config";
function y(e, t) {
  let r = [];
  return e && e[t] && e[t].palettes && (r = Object.keys(e[t].palettes).map((s) => s)), r;
}
function h(e, t, r) {
  var s, n, l, o;
  return e && ((o = (l = (n = (s = e == null ? void 0 : e.bg) == null ? void 0 : s.palettes) == null ? void 0 : n[t]) == null ? void 0 : l.colors) == null ? void 0 : o[r]) ? e.bg.palettes[t].colors[r] : "";
}
function f(e, t, r) {
  var s, n, l, o;
  return e && ((o = (l = (n = (s = e == null ? void 0 : e.border) == null ? void 0 : s.palettes) == null ? void 0 : n[t]) == null ? void 0 : l.colors) == null ? void 0 : o[r]) ? e.border.palettes[t].colors[r] : "";
}
function T(e, t, r) {
  var s, n, l, o;
  return e && ((o = (l = (n = (s = e == null ? void 0 : e.text) == null ? void 0 : s.palettes) == null ? void 0 : n[t]) == null ? void 0 : l.colors) == null ? void 0 : o[r]) ? e.text.palettes[t].colors[r] : "";
}
function i(e) {
  const t = e.toLowerCase();
  return a.includes(t) ? (console.error("The <" + e + "> tag is an Empty Element. Since Empty Elements do not have child node capabilities, they are not available as tags for this component."), !0) : !1;
}
function C(e) {
  const t = e.toLowerCase(), r = i(t), s = d(t);
  return !!(r || s);
}
function d(e) {
  const t = e.toLowerCase();
  return u.includes(t) ? (console.error("The <" + e + "> element tag is not supported for rendering by this component."), !0) : !1;
}
function O(e) {
  return Object.keys(e).length > 0 ? m(p, e) : p;
}
function P(e, t) {
  let r = Object.keys(t).length > 0 ? t : p, s = [];
  return r && r[e] && r[e].palettes && (s = Object.keys(r[e].palettes).map((n) => n)), s;
}
export {
  y as extractValidPalettes,
  h as getBgPaletteColor,
  f as getBorderPaletteColor,
  T as getTextPaletteColor,
  i as isEmptyElement,
  C as isEmptyOrUnsupportedElement,
  d as isUnsupportedElement,
  O as mergeAppConfigWithDefaults,
  P as validPaletteProps
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

UMD Version

Version used by Node.js (Universal version for Common.js/AMD)

js
(function(r,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@obewds/vue-validators"),require("deepmerge"),require("@obewds/obewds-tw-config")):typeof define=="function"&&define.amd?define(["exports","@obewds/vue-validators","deepmerge","@obewds/obewds-tw-config"],a):(r=typeof globalThis<"u"?globalThis:r||self,a(r.VueComponentHelpers={},r.VueValidators,r.deepmerge,r.ObewdsTwConfig))})(this,function(r,a,m,i){"use strict";const f=(e=>e&&typeof e=="object"&&"default"in e?e:{default:e})(m);function c(e,t){let s=[];return e&&e[t]&&e[t].palettes&&(s=Object.keys(e[t].palettes).map(n=>n)),s}function E(e,t,s){var n,l,o,u;return e&&((u=(o=(l=(n=e==null?void 0:e.bg)==null?void 0:n.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:u[s])?e.bg.palettes[t].colors[s]:""}function b(e,t,s){var n,l,o,u;return e&&((u=(o=(l=(n=e==null?void 0:e.border)==null?void 0:n.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:u[s])?e.border.palettes[t].colors[s]:""}function y(e,t,s){var n,l,o,u;return e&&((u=(o=(l=(n=e==null?void 0:e.text)==null?void 0:n.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:u[s])?e.text.palettes[t].colors[s]:""}function d(e){const t=e.toLowerCase();return a.emptyElementTags.includes(t)?(console.error("The <"+e+"> tag is an Empty Element. Since Empty Elements do not have child node capabilities, they are not available as tags for this component."),!0):!1}function h(e){const t=e.toLowerCase(),s=d(t),n=p(t);return!!(s||n)}function p(e){const t=e.toLowerCase();return a.unsupportedElementTags.includes(t)?(console.error("The <"+e+"> element tag is not supported for rendering by this component."),!0):!1}function P(e){return Object.keys(e).length>0?f.default(i.ObewdsTwConfig,e):i.ObewdsTwConfig}function C(e,t){let s=Object.keys(t).length>0?t:i.ObewdsTwConfig,n=[];return s&&s[e]&&s[e].palettes&&(n=Object.keys(s[e].palettes).map(l=>l)),n}r.extractValidPalettes=c,r.getBgPaletteColor=E,r.getBorderPaletteColor=b,r.getTextPaletteColor=y,r.isEmptyElement=d,r.isEmptyOrUnsupportedElement=h,r.isUnsupportedElement=p,r.mergeAppConfigWithDefaults=P,r.validPaletteProps=C,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1

CJS Version

CommonJS version

js
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@obewds/vue-validators"),d=require("deepmerge"),a=require("@obewds/obewds-tw-config"),m=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},c=m(d);function E(e,t){let r=[];return e&&e[t]&&e[t].palettes&&(r=Object.keys(e[t].palettes).map(s=>s)),r}function b(e,t,r){var s,l,o,n;return e&&((n=(o=(l=(s=e==null?void 0:e.bg)==null?void 0:s.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:n[r])?e.bg.palettes[t].colors[r]:""}function f(e,t,r){var s,l,o,n;return e&&((n=(o=(l=(s=e==null?void 0:e.border)==null?void 0:s.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:n[r])?e.border.palettes[t].colors[r]:""}function y(e,t,r){var s,l,o,n;return e&&((n=(o=(l=(s=e==null?void 0:e.text)==null?void 0:s.palettes)==null?void 0:l[t])==null?void 0:o.colors)==null?void 0:n[r])?e.text.palettes[t].colors[r]:""}function p(e){const t=e.toLowerCase();return u.emptyElementTags.includes(t)?(console.error("The <"+e+"> tag is an Empty Element. Since Empty Elements do not have child node capabilities, they are not available as tags for this component."),!0):!1}function g(e){const t=e.toLowerCase(),r=p(t),s=i(t);return!!(r||s)}function i(e){const t=e.toLowerCase();return u.unsupportedElementTags.includes(t)?(console.error("The <"+e+"> element tag is not supported for rendering by this component."),!0):!1}function C(e){return Object.keys(e).length>0?c.default(a.ObewdsTwConfig,e):a.ObewdsTwConfig}function P(e,t){let r=Object.keys(t).length>0?t:a.ObewdsTwConfig,s=[];return r&&r[e]&&r[e].palettes&&(s=Object.keys(r[e].palettes).map(l=>l)),s}exports.extractValidPalettes=E;exports.getBgPaletteColor=b;exports.getBorderPaletteColor=f;exports.getTextPaletteColor=y;exports.isEmptyElement=p;exports.isEmptyOrUnsupportedElement=g;exports.isUnsupportedElement=i;exports.mergeAppConfigWithDefaults=C;exports.validPaletteProps=P;
1

IIFE (Browser) Code

Version used for browser instances

js
var VueComponentHelpers=function(s,p,d,u){"use strict";const c=(e=>e&&typeof e=="object"&&"default"in e?e:{default:e})(d);function E(e,t){let r=[];return e&&e[t]&&e[t].palettes&&(r=Object.keys(e[t].palettes).map(l=>l)),r}function y(e,t,r){var l,n,a,o;return e&&((o=(a=(n=(l=e==null?void 0:e.bg)==null?void 0:l.palettes)==null?void 0:n[t])==null?void 0:a.colors)==null?void 0:o[r])?e.bg.palettes[t].colors[r]:""}function b(e,t,r){var l,n,a,o;return e&&((o=(a=(n=(l=e==null?void 0:e.border)==null?void 0:l.palettes)==null?void 0:n[t])==null?void 0:a.colors)==null?void 0:o[r])?e.border.palettes[t].colors[r]:""}function f(e,t,r){var l,n,a,o;return e&&((o=(a=(n=(l=e==null?void 0:e.text)==null?void 0:l.palettes)==null?void 0:n[t])==null?void 0:a.colors)==null?void 0:o[r])?e.text.palettes[t].colors[r]:""}function i(e){const t=e.toLowerCase();return p.emptyElementTags.includes(t)?(console.error("The <"+e+"> tag is an Empty Element. Since Empty Elements do not have child node capabilities, they are not available as tags for this component."),!0):!1}function P(e){const t=e.toLowerCase(),r=i(t),l=m(t);return!!(r||l)}function m(e){const t=e.toLowerCase();return p.unsupportedElementTags.includes(t)?(console.error("The <"+e+"> element tag is not supported for rendering by this component."),!0):!1}function C(e){return Object.keys(e).length>0?c.default(u.ObewdsTwConfig,e):u.ObewdsTwConfig}function h(e,t){let r=Object.keys(t).length>0?t:u.ObewdsTwConfig,l=[];return r&&r[e]&&r[e].palettes&&(l=Object.keys(r[e].palettes).map(n=>n)),l}return s.extractValidPalettes=E,s.getBgPaletteColor=y,s.getBorderPaletteColor=b,s.getTextPaletteColor=f,s.isEmptyElement=i,s.isEmptyOrUnsupportedElement=P,s.isUnsupportedElement=m,s.mergeAppConfigWithDefaults=C,s.validPaletteProps=h,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),s}({},VueValidators,deepmerge,ObewdsTwConfig);
1