| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.attributeKeys = exports.attributeOf = exports.effectTiming = void 0;
- const container_1 = require("../utils/container");
- function effectTiming(defaults, value, options) {
- return container_1.Container.of({})
- .call(assignDefined, defaults)
- .call(assignDefined, value)
- .call(assignDefined, options)
- .value();
- }
- exports.effectTiming = effectTiming;
- function assignDefined(target, source) {
- for (const [key, value] of Object.entries(source)) {
- if (value !== undefined) {
- target[key] = source[key];
- }
- }
- return target;
- }
- // TODO: Add more attributes need to be transform.
- // TODO: Opacity transform unexpectedly.
- function attributeOf(shape, keys) {
- const attribute = {};
- for (const key of keys) {
- const value = shape.style[key];
- if (value) {
- attribute[key] = value;
- }
- }
- return attribute;
- }
- exports.attributeOf = attributeOf;
- exports.attributeKeys = [
- 'fill',
- 'stroke',
- 'fillOpacity',
- 'strokeOpacity',
- 'opacity',
- 'lineWidth',
- ];
- //# sourceMappingURL=utils.js.map
|