@dndbuilder.com/react
Version:
Drag and drop builder for React
78 lines (77 loc) • 3.64 kB
JavaScript
import { createSelector as s } from "../node_modules/.pnpm/reselect@5.1.1/node_modules/reselect/dist/reselect.js";
import o from "../_virtual/index.js";
const g = (e) => e.builder.present.content.root, p = (e) => e.builder.present.content, b = (e) => (t) => t.builder.present.content[e], B = (e) => (t) => e.map((n) => t.builder.present.content[n]), h = (e) => (t) => t.builder.present.content[e].settings, k = (e, t) => (n) => {
const r = t.replace("{{BREAKPOINT}}", n.builder.present.currentBreakpoint).replace("{{LOCALE}}", n.builder.present.currentLocale);
return o.get(n.builder.present.content[e], `settings.${r}`);
}, a = (e) => (t) => t.builder.present.content[e].advancedSettings, m = (e, t) => (n) => {
const r = t.replace("{{BREAKPOINT}}", n.builder.present.currentBreakpoint);
return o.get(n.builder.present.content[e], `advancedSettings.${r}`);
}, v = (e) => e.builder.present.selectedBlockId ? e.builder.present.content[e.builder.present.selectedBlockId] : null, S = (e) => e.builder.present.selectedBlockId, T = (e) => (t) => {
const n = (r) => t.builder.present.content[r].children.some((c) => t.builder.present.selectedBlockId === c ? !0 : n(c));
return n(e);
}, A = (e) => (t) => t.builder.present.content[t.builder.present.content[e].parentId].children.indexOf(e), I = (e) => (t) => t.builder.present.selectedBlockId === e, y = (e) => e.builder.present.currentBreakpoint, f = (e) => e.builder.present.currentLocale, C = (e) => e.theme.activeTheme, K = (e) => e.theme.activeTheme.id, l = (e) => e.theme.activeTheme.settings, P = s(
l,
(e) => {
var t;
return ((t = e.layout) == null ? void 0 : t.container) || {};
}
), E = s(l, (e) => e.color || {}), L = (e) => (t) => o.get(t.theme.activeTheme.settings, e), N = s(l, (e) => e.color.presets), O = s(
l,
(e) => e.typography.presets
), w = s(l, (e) => e.button.presets), R = (e) => (t) => {
if (e === "block" || e === "advanced") {
const n = t.builder.present.selectedBlockId;
if (!n)
throw new Error("No block selected");
return e === "block" ? t.builder.present.content[n].settings : t.builder.present.content[n].advancedSettings;
}
return t.theme.activeTheme.settings;
}, V = (e, t) => (n) => {
if (t === "block" || t === "advanced") {
const r = n.builder.present.selectedBlockId;
if (!r)
throw new Error("No block selected");
const c = e.replace("{{BREAKPOINT}}", n.builder.present.currentBreakpoint);
return t === "block" ? o.get(
n.builder.present.content[r],
`settings.${c}`
) : o.get(
n.builder.present.content[r],
`advancedSettings.${c}`
);
}
return o.get(n.theme.activeTheme.settings, e);
}, i = (e) => (t) => t.builder.present.content[e].children.map((c) => ({
...t.builder.present.content[c],
children: i(c)(t)
}));
export {
C as getActiveTheme,
w as getActiveThemeButtonPresets,
N as getActiveThemeColorPresets,
E as getActiveThemeColorSettings,
P as getActiveThemeContainerSettings,
K as getActiveThemeId,
l as getActiveThemeSettings,
L as getActiveThemeSettingsValueByKey,
O as getActiveThemeTypographyPresets,
b as getBlock,
a as getBlockAdvancedSettings,
m as getBlockAdvancedSettingsValueByKey,
A as getBlockIndex,
h as getBlockSettings,
k as getBlockSettingsValueByKey,
B as getBlocks,
p as getContent,
g as getContentRoot,
y as getCurrentBreakpoint,
f as getCurrentLocale,
T as getIsAnyChildSelected,
I as getIsBlockSelected,
v as getSelectedBlock,
S as getSelectedBlockId,
R as getSettings,
V as getSettingsValueByKey,
i as loadBlockChildren
};
//# sourceMappingURL=selectors.js.map