@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
31 lines (30 loc) • 1.01 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let ___hooks_ts = require("../hooks.cjs");
// packages/global-styles-ui/src/presets/use-presets.ts
const EMPTY_ARRAY = [];
/**
* Read + mutate the preset array stored at `${settingsPath}.${origin}`.
*
* `presets` reflects the merged (user-edited) value; `basePresets` is read
* explicitly from the theme base, used to compare against or reset to the
* theme-provided values.
*
* @param settingsPath Origin-keyed base path, e.g. 'shadow.presets'.
* @param origin 'default' | 'theme' | 'custom'.
*/
function usePresets(settingsPath, origin) {
const path = `${settingsPath}.${origin}`;
const [presets = EMPTY_ARRAY, setPresets] = (0, ___hooks_ts.useSetting)(path);
const [basePresets = EMPTY_ARRAY] = (0, ___hooks_ts.useSetting)(path, void 0, "base");
return {
presets,
basePresets,
setPresets
};
}
exports.usePresets = usePresets;
//# sourceMappingURL=use-presets.cjs.map