@carbon/ibm-products-web-components
Version:
Carbon for IBM Products Web Components
40 lines (36 loc) • 1.14 kB
JavaScript
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { signal } from '@lit-labs/signals';
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const coachmarkDetailsSignal = signal({
open: false,
floating: false,
});
const resetCoachmarkDetailsSignal = () => {
coachmarkDetailsSignal.set({
open: false,
floating: false,
});
};
const updateCoachmarkDetailsSignal = ({ name, detail }) => {
// Fetch current value once
const currentValue = coachmarkDetailsSignal.get();
// Only set if value really changes
if (currentValue[name] !== detail) {
const newValue = Object.assign(Object.assign({}, currentValue), { [name]: detail });
coachmarkDetailsSignal.set(newValue);
}
};
export { coachmarkDetailsSignal, resetCoachmarkDetailsSignal, updateCoachmarkDetailsSignal };
//# sourceMappingURL=coachmark-context.js.map