modern-idoc 0.9.10 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -7
- package/dist/index.d.cts +18 -18
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +2 -2
- package/dist/index.mjs +17 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -279,8 +279,6 @@ function propertyOffsetSet(target, key, newValue, declaration) {
|
|
|
279
279
|
}
|
|
280
280
|
function propertyOffsetGet(target, key, declaration) {
|
|
281
281
|
const {
|
|
282
|
-
default: _default,
|
|
283
|
-
fallback,
|
|
284
282
|
alias,
|
|
285
283
|
internalKey
|
|
286
284
|
} = declaration;
|
|
@@ -290,8 +288,16 @@ function propertyOffsetGet(target, key, declaration) {
|
|
|
290
288
|
} else {
|
|
291
289
|
result = target[internalKey];
|
|
292
290
|
}
|
|
293
|
-
result = result ?? (
|
|
294
|
-
|
|
291
|
+
result = result ?? propertyOffsetDefaultValue(target, key, declaration);
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
function propertyOffsetDefaultValue(target, key, declaration) {
|
|
295
|
+
const {
|
|
296
|
+
default: _default,
|
|
297
|
+
fallback
|
|
298
|
+
} = declaration;
|
|
299
|
+
let result;
|
|
300
|
+
if (_default !== void 0 && !target[initedSymbol]) {
|
|
295
301
|
target[initedSymbol] = true;
|
|
296
302
|
const defaultValue = typeof _default === "function" ? _default() : _default;
|
|
297
303
|
if (defaultValue !== void 0) {
|
|
@@ -299,6 +305,7 @@ function propertyOffsetGet(target, key, declaration) {
|
|
|
299
305
|
result = defaultValue;
|
|
300
306
|
}
|
|
301
307
|
}
|
|
308
|
+
result = result ?? (typeof fallback === "function" ? fallback() : fallback);
|
|
302
309
|
return result;
|
|
303
310
|
}
|
|
304
311
|
function getPropertyDescriptor(key, declaration) {
|
|
@@ -388,17 +395,19 @@ class Reactivable extends Observable {
|
|
|
388
395
|
isDirty(key) {
|
|
389
396
|
return key ? this._updatedProperties.has(key) : this._updatedProperties.size > 0;
|
|
390
397
|
}
|
|
391
|
-
getProperty(key
|
|
398
|
+
getProperty(key) {
|
|
392
399
|
const declaration = this.getPropertyDeclaration(key);
|
|
393
400
|
if (declaration) {
|
|
394
401
|
if (declaration.internal || declaration.alias) {
|
|
395
402
|
return propertyOffsetGet(this, key, declaration);
|
|
396
403
|
} else {
|
|
404
|
+
let result;
|
|
397
405
|
if (this._propertyAccessor?.getProperty) {
|
|
398
|
-
|
|
406
|
+
result = this._propertyAccessor.getProperty(key);
|
|
399
407
|
} else {
|
|
400
|
-
|
|
408
|
+
result = this._properties.get(key);
|
|
401
409
|
}
|
|
410
|
+
return result ?? propertyOffsetDefaultValue(this, key, declaration);
|
|
402
411
|
}
|
|
403
412
|
}
|
|
404
413
|
return void 0;
|
|
@@ -1924,6 +1933,7 @@ exports.parseGradient = parseGradient;
|
|
|
1924
1933
|
exports.pick = pick;
|
|
1925
1934
|
exports.property = property;
|
|
1926
1935
|
exports.property2 = property2;
|
|
1936
|
+
exports.propertyOffsetDefaultValue = propertyOffsetDefaultValue;
|
|
1927
1937
|
exports.propertyOffsetGet = propertyOffsetGet;
|
|
1928
1938
|
exports.propertyOffsetSet = propertyOffsetSet;
|
|
1929
1939
|
exports.round = round;
|
package/dist/index.d.cts
CHANGED
|
@@ -330,19 +330,20 @@ interface PropertyDeclaration {
|
|
|
330
330
|
internalKey: symbol;
|
|
331
331
|
}
|
|
332
332
|
interface PropertyAccessor {
|
|
333
|
-
getProperty?: (key: string
|
|
333
|
+
getProperty?: (key: string) => any;
|
|
334
334
|
setProperty?: (key: string, newValue: any) => void;
|
|
335
335
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
336
336
|
}
|
|
337
337
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
338
338
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
339
339
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
|
+
declare function propertyOffsetDefaultValue(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
341
|
declare function getPropertyDescriptor<V, T extends PropertyAccessor>(key: string, declaration: PropertyDeclaration): {
|
|
341
342
|
get: () => any;
|
|
342
343
|
set: (v: any) => void;
|
|
343
344
|
};
|
|
344
345
|
declare function defineProperty<V, T extends PropertyAccessor>(constructor: any, key: string, declaration?: Partial<PropertyDeclaration>): void;
|
|
345
|
-
declare function property<V, T extends PropertyAccessor>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
346
|
+
declare function property<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): PropertyDecorator;
|
|
346
347
|
declare function property2<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
347
348
|
|
|
348
349
|
interface NormalizedInnerShadow {
|
|
@@ -813,12 +814,12 @@ type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
|
813
814
|
type EventListenerOptions = boolean | {
|
|
814
815
|
once?: boolean;
|
|
815
816
|
};
|
|
816
|
-
interface EventListener
|
|
817
|
+
interface EventListener<T extends any[] = any[]> {
|
|
817
818
|
value: EventListenerValue<T>;
|
|
818
819
|
options?: EventListenerOptions;
|
|
819
820
|
}
|
|
820
821
|
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
821
|
-
eventListeners: Map<keyof T, EventListener
|
|
822
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
822
823
|
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
823
824
|
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
824
825
|
removeAllListeners(): this;
|
|
@@ -841,16 +842,15 @@ declare function setNestedValue(obj: any, path: (string | number)[], value: any)
|
|
|
841
842
|
declare function getObjectValueByPath(obj: any, path: string, fallback?: any): any;
|
|
842
843
|
declare function setObjectValueByPath(obj: any, path: string, value: any): void;
|
|
843
844
|
|
|
844
|
-
type EventListener = (...args: any[]) => void;
|
|
845
845
|
interface ObservableEvents {
|
|
846
|
-
[event: string]:
|
|
846
|
+
[event: string]: any[];
|
|
847
847
|
}
|
|
848
848
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
849
849
|
_observers: Map<string, Set<any>>;
|
|
850
|
-
on<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
851
|
-
once<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
852
|
-
off<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
853
|
-
emit<K extends keyof T & string>(event: K, ...args:
|
|
850
|
+
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
851
|
+
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
852
|
+
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
853
|
+
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
854
854
|
destroy(): void;
|
|
855
855
|
}
|
|
856
856
|
|
|
@@ -864,13 +864,13 @@ declare class RawWeakMap<K extends WeakKey = WeakKey, V = any> {
|
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
interface ReactivableEvents extends ObservableEvents {
|
|
867
|
-
updateProperty:
|
|
867
|
+
updateProperty: [key: string, newValue: any, oldValue: any];
|
|
868
868
|
}
|
|
869
869
|
interface Reactivable {
|
|
870
|
-
on: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
871
|
-
once: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
872
|
-
off: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
873
|
-
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args:
|
|
870
|
+
on: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
871
|
+
once: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
872
|
+
off: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
873
|
+
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args: ReactivableEvents[K]) => this;
|
|
874
874
|
}
|
|
875
875
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
876
876
|
protected _propertyAccessor?: PropertyAccessor;
|
|
@@ -881,7 +881,7 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
881
881
|
protected _updating: boolean;
|
|
882
882
|
constructor(properties?: Record<string, any>);
|
|
883
883
|
isDirty(key?: string): boolean;
|
|
884
|
-
getProperty(key: string
|
|
884
|
+
getProperty(key: string): any;
|
|
885
885
|
setProperty(key: string, newValue: any): void;
|
|
886
886
|
getProperties(keys?: string[]): Record<string, any>;
|
|
887
887
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -900,5 +900,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
900
900
|
clone(): this;
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
|
903
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetDefaultValue, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.d.mts
CHANGED
|
@@ -330,19 +330,20 @@ interface PropertyDeclaration {
|
|
|
330
330
|
internalKey: symbol;
|
|
331
331
|
}
|
|
332
332
|
interface PropertyAccessor {
|
|
333
|
-
getProperty?: (key: string
|
|
333
|
+
getProperty?: (key: string) => any;
|
|
334
334
|
setProperty?: (key: string, newValue: any) => void;
|
|
335
335
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
336
336
|
}
|
|
337
337
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
338
338
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
339
339
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
|
+
declare function propertyOffsetDefaultValue(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
341
|
declare function getPropertyDescriptor<V, T extends PropertyAccessor>(key: string, declaration: PropertyDeclaration): {
|
|
341
342
|
get: () => any;
|
|
342
343
|
set: (v: any) => void;
|
|
343
344
|
};
|
|
344
345
|
declare function defineProperty<V, T extends PropertyAccessor>(constructor: any, key: string, declaration?: Partial<PropertyDeclaration>): void;
|
|
345
|
-
declare function property<V, T extends PropertyAccessor>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
346
|
+
declare function property<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): PropertyDecorator;
|
|
346
347
|
declare function property2<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
347
348
|
|
|
348
349
|
interface NormalizedInnerShadow {
|
|
@@ -813,12 +814,12 @@ type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
|
813
814
|
type EventListenerOptions = boolean | {
|
|
814
815
|
once?: boolean;
|
|
815
816
|
};
|
|
816
|
-
interface EventListener
|
|
817
|
+
interface EventListener<T extends any[] = any[]> {
|
|
817
818
|
value: EventListenerValue<T>;
|
|
818
819
|
options?: EventListenerOptions;
|
|
819
820
|
}
|
|
820
821
|
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
821
|
-
eventListeners: Map<keyof T, EventListener
|
|
822
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
822
823
|
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
823
824
|
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
824
825
|
removeAllListeners(): this;
|
|
@@ -841,16 +842,15 @@ declare function setNestedValue(obj: any, path: (string | number)[], value: any)
|
|
|
841
842
|
declare function getObjectValueByPath(obj: any, path: string, fallback?: any): any;
|
|
842
843
|
declare function setObjectValueByPath(obj: any, path: string, value: any): void;
|
|
843
844
|
|
|
844
|
-
type EventListener = (...args: any[]) => void;
|
|
845
845
|
interface ObservableEvents {
|
|
846
|
-
[event: string]:
|
|
846
|
+
[event: string]: any[];
|
|
847
847
|
}
|
|
848
848
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
849
849
|
_observers: Map<string, Set<any>>;
|
|
850
|
-
on<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
851
|
-
once<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
852
|
-
off<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
853
|
-
emit<K extends keyof T & string>(event: K, ...args:
|
|
850
|
+
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
851
|
+
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
852
|
+
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
853
|
+
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
854
854
|
destroy(): void;
|
|
855
855
|
}
|
|
856
856
|
|
|
@@ -864,13 +864,13 @@ declare class RawWeakMap<K extends WeakKey = WeakKey, V = any> {
|
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
interface ReactivableEvents extends ObservableEvents {
|
|
867
|
-
updateProperty:
|
|
867
|
+
updateProperty: [key: string, newValue: any, oldValue: any];
|
|
868
868
|
}
|
|
869
869
|
interface Reactivable {
|
|
870
|
-
on: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
871
|
-
once: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
872
|
-
off: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
873
|
-
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args:
|
|
870
|
+
on: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
871
|
+
once: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
872
|
+
off: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
873
|
+
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args: ReactivableEvents[K]) => this;
|
|
874
874
|
}
|
|
875
875
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
876
876
|
protected _propertyAccessor?: PropertyAccessor;
|
|
@@ -881,7 +881,7 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
881
881
|
protected _updating: boolean;
|
|
882
882
|
constructor(properties?: Record<string, any>);
|
|
883
883
|
isDirty(key?: string): boolean;
|
|
884
|
-
getProperty(key: string
|
|
884
|
+
getProperty(key: string): any;
|
|
885
885
|
setProperty(key: string, newValue: any): void;
|
|
886
886
|
getProperties(keys?: string[]): Record<string, any>;
|
|
887
887
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -900,5 +900,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
900
900
|
clone(): this;
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
|
903
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetDefaultValue, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.d.ts
CHANGED
|
@@ -330,19 +330,20 @@ interface PropertyDeclaration {
|
|
|
330
330
|
internalKey: symbol;
|
|
331
331
|
}
|
|
332
332
|
interface PropertyAccessor {
|
|
333
|
-
getProperty?: (key: string
|
|
333
|
+
getProperty?: (key: string) => any;
|
|
334
334
|
setProperty?: (key: string, newValue: any) => void;
|
|
335
335
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
336
336
|
}
|
|
337
337
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
338
338
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
339
339
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
|
+
declare function propertyOffsetDefaultValue(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
340
341
|
declare function getPropertyDescriptor<V, T extends PropertyAccessor>(key: string, declaration: PropertyDeclaration): {
|
|
341
342
|
get: () => any;
|
|
342
343
|
set: (v: any) => void;
|
|
343
344
|
};
|
|
344
345
|
declare function defineProperty<V, T extends PropertyAccessor>(constructor: any, key: string, declaration?: Partial<PropertyDeclaration>): void;
|
|
345
|
-
declare function property<V, T extends PropertyAccessor>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
346
|
+
declare function property<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): PropertyDecorator;
|
|
346
347
|
declare function property2<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
347
348
|
|
|
348
349
|
interface NormalizedInnerShadow {
|
|
@@ -813,12 +814,12 @@ type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
|
813
814
|
type EventListenerOptions = boolean | {
|
|
814
815
|
once?: boolean;
|
|
815
816
|
};
|
|
816
|
-
interface EventListener
|
|
817
|
+
interface EventListener<T extends any[] = any[]> {
|
|
817
818
|
value: EventListenerValue<T>;
|
|
818
819
|
options?: EventListenerOptions;
|
|
819
820
|
}
|
|
820
821
|
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
821
|
-
eventListeners: Map<keyof T, EventListener
|
|
822
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
822
823
|
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
823
824
|
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
824
825
|
removeAllListeners(): this;
|
|
@@ -841,16 +842,15 @@ declare function setNestedValue(obj: any, path: (string | number)[], value: any)
|
|
|
841
842
|
declare function getObjectValueByPath(obj: any, path: string, fallback?: any): any;
|
|
842
843
|
declare function setObjectValueByPath(obj: any, path: string, value: any): void;
|
|
843
844
|
|
|
844
|
-
type EventListener = (...args: any[]) => void;
|
|
845
845
|
interface ObservableEvents {
|
|
846
|
-
[event: string]:
|
|
846
|
+
[event: string]: any[];
|
|
847
847
|
}
|
|
848
848
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
849
849
|
_observers: Map<string, Set<any>>;
|
|
850
|
-
on<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
851
|
-
once<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
852
|
-
off<K extends keyof T & string>(event: K, listener: T[K]): this;
|
|
853
|
-
emit<K extends keyof T & string>(event: K, ...args:
|
|
850
|
+
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
851
|
+
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
852
|
+
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
853
|
+
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
854
854
|
destroy(): void;
|
|
855
855
|
}
|
|
856
856
|
|
|
@@ -864,13 +864,13 @@ declare class RawWeakMap<K extends WeakKey = WeakKey, V = any> {
|
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
interface ReactivableEvents extends ObservableEvents {
|
|
867
|
-
updateProperty:
|
|
867
|
+
updateProperty: [key: string, newValue: any, oldValue: any];
|
|
868
868
|
}
|
|
869
869
|
interface Reactivable {
|
|
870
|
-
on: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
871
|
-
once: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
872
|
-
off: <K extends keyof ReactivableEvents & string>(event: K, listener: ReactivableEvents[K]) => this;
|
|
873
|
-
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args:
|
|
870
|
+
on: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
871
|
+
once: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
872
|
+
off: <K extends keyof ReactivableEvents & string>(event: K, listener: (...args: ReactivableEvents[K]) => void) => this;
|
|
873
|
+
emit: <K extends keyof ReactivableEvents & string>(event: K, ...args: ReactivableEvents[K]) => this;
|
|
874
874
|
}
|
|
875
875
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
876
876
|
protected _propertyAccessor?: PropertyAccessor;
|
|
@@ -881,7 +881,7 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
881
881
|
protected _updating: boolean;
|
|
882
882
|
constructor(properties?: Record<string, any>);
|
|
883
883
|
isDirty(key?: string): boolean;
|
|
884
|
-
getProperty(key: string
|
|
884
|
+
getProperty(key: string): any;
|
|
885
885
|
setProperty(key: string, newValue: any): void;
|
|
886
886
|
getProperties(keys?: string[]): Record<string, any>;
|
|
887
887
|
setProperties(properties?: Record<string, any>): this;
|
|
@@ -900,5 +900,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
|
|
|
900
900
|
clone(): this;
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
-
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
|
903
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetDefaultValue, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
904
|
+
export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(o=typeof globalThis<"u"?globalThis:o||self,j(o.modernIdoc={}))})(this,(function(o){"use strict";function j(t){return typeof t=="string"?{src:t}:t}var _e={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},z=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},mt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},vt=function(t){return{r:z(t.r,0,255),g:z(t.g,0,255),b:z(t.b,0,255),a:z(t.a)}},tt=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},Ce=/^#([0-9a-f]{3,8})$/i,K=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},yt=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=Math.max(e,r,n),s=a-Math.min(e,r,n),u=s?a===e?(r-n)/s:a===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(u<0?u+6:u),s:a?s/a*100:0,v:a/255*100,a:i}},bt=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var a=Math.floor(e),s=n*(1-r),u=n*(1-(e-a)*r),f=n*(1-(1-e+a)*r),g=a%6;return{r:255*[n,u,s,s,f,n][g],g:255*[f,n,n,u,s,s][g],b:255*[s,s,f,n,n,u][g],a:i}},St=function(t){return{h:mt(t.h),s:z(t.s,0,100),l:z(t.l,0,100),a:z(t.a)}},_t=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},Ct=function(t){return bt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},V=function(t){return{h:(e=yt(t)).h,s:(i=(200-(r=e.s))*(n=e.v)/100)>0&&i<200?r*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,r,n,i},we=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ze=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wt={string:[[function(t){var e=Ce.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?v(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=ze.exec(t)||Oe.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:vt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=we.exec(t)||Pe.exec(t);if(!e)return null;var r,n,i=St({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(_e[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Ct(i)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=i===void 0?1:i;return D(e)&&D(r)&&D(n)?vt({r:Number(e),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(r)||!D(n))return null;var s=St({h:Number(e),s:Number(r),l:Number(n),a:Number(a)});return Ct(s)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(r)||!D(n))return null;var s=(function(u){return{h:mt(u.h),s:z(u.s,0,100),v:z(u.v,0,100),a:z(u.a)}})({h:Number(e),s:Number(r),v:Number(n),a:Number(a)});return bt(s)},"hsv"]]},Pt=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},Ee=function(t){return typeof t=="string"?Pt(t.trim(),wt.string):typeof t=="object"&&t!==null?Pt(t,wt.object):[null,void 0]},et=function(t,e){var r=V(t);return{h:r.h,s:z(r.s+100*e,0,100),l:r.l,a:r.a}},rt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},zt=function(t,e){var r=V(t);return{h:r.h,s:r.s,l:z(r.l+100*e,0,100),a:r.a}},Ot=(function(){function t(e){this.parsed=Ee(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return v(rt(this.rgba),2)},t.prototype.isDark=function(){return rt(this.rgba)<.5},t.prototype.isLight=function(){return rt(this.rgba)>=.5},t.prototype.toHex=function(){return e=tt(this.rgba),r=e.r,n=e.g,i=e.b,s=(a=e.a)<1?K(v(255*a)):"","#"+K(r)+K(n)+K(i)+s;var e,r,n,i,a,s},t.prototype.toRgb=function(){return tt(this.rgba)},t.prototype.toRgbString=function(){return e=tt(this.rgba),r=e.r,n=e.g,i=e.b,(a=e.a)<1?"rgba("+r+", "+n+", "+i+", "+a+")":"rgb("+r+", "+n+", "+i+")";var e,r,n,i,a},t.prototype.toHsl=function(){return _t(V(this.rgba))},t.prototype.toHslString=function(){return e=_t(V(this.rgba)),r=e.h,n=e.s,i=e.l,(a=e.a)<1?"hsla("+r+", "+n+"%, "+i+"%, "+a+")":"hsl("+r+", "+n+"%, "+i+"%)";var e,r,n,i,a},t.prototype.toHsv=function(){return e=yt(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return L({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),L(et(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),L(et(this.rgba,-e))},t.prototype.grayscale=function(){return L(et(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),L(zt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),L(zt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?L({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):v(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=V(this.rgba);return typeof e=="number"?L({h:e,s:r.s,l:r.l,a:r.a}):v(r.h)},t.prototype.isEqual=function(e){return this.toHex()===L(e).toHex()},t})(),L=function(t){return t instanceof Ot?t:new Ot(t)};class Fe{eventListeners=new Map;addEventListener(e,r,n){const i={value:r,options:n},a=this.eventListeners.get(e);return a?Array.isArray(a)?a.push(i):this.eventListeners.set(e,[a,i]):this.eventListeners.set(e,i),this}removeEventListener(e,r,n){if(!r)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let s=0,u=i.length;s<u;s++){const f=i[s];(f.value!==r||typeof n=="object"&&n?.once&&(typeof f.options=="boolean"||!f.options?.once))&&a.push(f)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===r&&(typeof n=="boolean"||!n?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...r){const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let i=n.length,a=0;a<i;a++){const s=n[a];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.value.apply(this,r)}else typeof n.options=="object"&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,r);return!0}else return!1}on(e,r,n){return this.addEventListener(e,r,n)}once(e,r){return this.addEventListener(e,r,{once:!0})}off(e,r,n){return this.removeEventListener(e,r,n)}emit(e,...r){this.dispatchEvent(e,...r)}}function h(t){return t==null||t==="none"}function A(t,e=0,r=10**e){return Math.round(r*t)/r+0}function _(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>_(n,e)):t;const r={};for(const n in t){const i=t[n];i!=null&&(e?r[n]=_(i,e):r[n]=i)}return r}function N(t,e){const r={};return e.forEach(n=>{n in t&&(r[n]=t[n])}),r}function q(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const r=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!r.length||r.every(n=>t[n]===e[n])}return!1}function Et(t,e,r){const n=e.length-1;if(n<0)return t===void 0?r:t;for(let i=0;i<n;i++){if(t==null)return r;t=t[e[i]]}return t==null||t[e[n]]===void 0?r:t[e[n]]}function Ft(t,e,r){const n=e.length-1;for(let i=0;i<n;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[n]]=r}function Lt(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Et(t,e.split("."),r))}function Dt(t,e,r){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Ft(t,e.split("."),r)}class At{_observers=new Map;on(e,r){let n=this._observers.get(e);return n===void 0&&this._observers.set(e,n=new Set),n.add(r),this}once(e,r){const n=(...i)=>{this.off(e,n),r(...i)};return this.on(e,n),this}off(e,r){const n=this._observers.get(e);return n!==void 0&&(n.delete(r),n.size===0&&this._observers.delete(e)),this}emit(e,...r){return Array.from((this._observers.get(e)||new Map).values()).forEach(n=>n(...r)),this}destroy(){this._observers=new Map}}class Le{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const r=e.__v_raw;r&&(e=this._toRaw(r))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,r){return this._map.set(this._toRaw(e),this._toRaw(r)),this}}const nt=Symbol("properties"),Nt=Symbol("inited");function k(t){let e;if(Object.hasOwn(t,nt))e=t[nt];else{const r=Object.getPrototypeOf(t);e=new Map(r?k(r):void 0),t[nt]=e}return e}function it(t,e,r,n){const{alias:i,internalKey:a}=n,s=t[e];i?Dt(t,i,r):t[a]=r,t.onUpdateProperty?.(e,r,s)}function ot(t,e,r){const{default:n,fallback:i,alias:a,internalKey:s}=r;let u;if(a?u=Lt(t,a):u=t[s],u=u??(typeof i=="function"?i():i),u===void 0&&n!==void 0&&!t[Nt]){t[Nt]=!0;const f=typeof n=="function"?n():n;f!==void 0&&(t[e]=f,u=f)}return u}function at(t,e){function r(){return typeof this.getProperty<"u"?this.getProperty(t):ot(this,t,e)}function n(i){typeof this.setProperty<"u"?this.setProperty(t,i):it(this,t,i,e)}return{get:r,set:n}}function Rt(t,e,r={}){const n={...r,internalKey:Symbol(e)};k(t).set(e,n);const i=at(e,n);Object.defineProperty(t.prototype,e,{get(){return i.get.call(this)},set(a){i.set.call(this,a)},configurable:!0,enumerable:!0})}function De(t){return function(e,r){if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Rt(e.constructor,r,t)}}function Ae(t={}){return function(e,r){const n=r.name;if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i={...t,internalKey:Symbol(n)},a=at(n,i);return{init(s){return k(this.constructor).set(n,i),a.set.call(this,s),s},get(){return a.get.call(this)},set(s){a.set.call(this,s)}}}}class Ne extends At{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e,r){const n=this.getPropertyDeclaration(e);if(n)return n.internal||n.alias?ot(this,e,n):this._propertyAccessor?.getProperty?this._propertyAccessor.getProperty(e,r):this._properties.get(e)??r}setProperty(e,r){const n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)it(this,e,r,n);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,r),this._properties.set(e,r),this.onUpdateProperty?.(e,r,i)}}getProperties(e){const r={};for(const[n,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(n))&&(r[n]=this.getProperty(n));return r}setProperties(e){if(e&&typeof e=="object")for(const r in e)this.setProperty(r,e[r]);return this}resetProperties(){for(const[e,r]of this.getPropertyDeclarations())this.setProperty(e,typeof r.default=="function"?r.default():r.default);return this}getPropertyDeclarations(){return k(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const r=this.getPropertyDeclarations();this._propertyAccessor=void 0;const n={};return r.forEach((i,a)=>{n[a]=this.getProperty(a)}),this._propertyAccessor=e,r.forEach((i,a)=>{const s=this.getProperty(a),u=n[a];s!==void 0&&!Object.is(s,u)&&(this.setProperty(a,s),!i.internal&&!i.alias&&this.requestUpdate(a,s,u))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,r,n){Object.is(r,n)||this.requestUpdate(e,r,n)}requestUpdate(e,r,n){e!==void 0&&(this._updatedProperties.set(e,n),this._changedProperties.add(e),this._updateProperty(e,r,n),this.emit("updateProperty",e,r,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,r,n){}toJSON(){const e={};return this._properties.forEach((r,n)=>{r!==void 0&&(r&&typeof r=="object"?"toJSON"in r&&typeof r.toJSON=="function"?e[n]=r.toJSON():Array.isArray(r)?e[n]=[...r]:e[n]={...r}:e[n]=r)}),e}clone(){return new this.constructor(this.toJSON())}}function st(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,L(e)}function Re(t){return{r:A(t.r),g:A(t.g),b:A(t.b),a:A(t.a,3)}}function J(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const $="#000000FF";function Gt(t){return st(t).isValid()}function S(t,e=!1){const r=st(t);if(!r.isValid()){if(typeof t=="string")return t;const u=`Failed to normalizeColor ${t}`;if(e)throw new Error(u);return console.warn(u),$}const{r:n,g:i,b:a,a:s}=Re(r.rgba);return`#${J(n)}${J(i)}${J(a)}${J(A(s*255))}`}var x=x||{};x.parse=(function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(l){const c=new Error(`${e}: ${l}`);throw c.source=e,c}function n(){const l=i();return e.length>0&&r("Invalid input not EOF"),l}function i(){return M(a)}function a(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,p)||s("repeating-radial-gradient",t.repeatingRadialGradient,p)}function s(l,c,d){return u(c,b=>{const I=d();return I&&(m(t.comma)||r("Missing comma before color stops")),{type:l,orientation:I,colorStops:M(gt)}})}function u(l,c){const d=m(l);if(d){m(t.startCall)||r("Missing (");const b=c(d);return m(t.endCall)||r("Missing )"),b}}function f(){const l=g();if(l)return l;const c=P("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:y()}function g(){return P("directional",t.sideOrCorner,1)}function y(){return P("angular",t.angleValue,1)||P("angular",t.radianValue,1)}function p(){let l,c=C(),d;return c&&(l=[],l.push(c),d=e,m(t.comma)&&(c=C(),c?l.push(c):e=d)),l}function C(){let l=w()||R();if(l)l.at=F();else{const c=O();if(c){l=c;const d=F();d&&(l.at=d)}else{const d=F();if(d)l={type:"default-radial",at:d};else{const b=G();b&&(l={type:"default-radial",at:b})}}}return l}function w(){const l=P("shape",/^(circle)/i,0);return l&&(l.style=Se()||O()),l}function R(){const l=P("shape",/^(ellipse)/i,0);return l&&(l.style=G()||Q()||O()),l}function O(){return P("extent-keyword",t.extentKeywords,1)}function F(){if(P("position",/^at/,0)){const l=G();return l||r("Missing positioning value"),l}}function G(){const l=B();if(l.x||l.y)return{type:"position",value:l}}function B(){return{x:Q(),y:Q()}}function M(l){let c=l();const d=[];if(c)for(d.push(c);m(t.comma);)c=l(),c?d.push(c):r("One extra comma");return d}function gt(){const l=Ke();return l||r("Expected color definition"),l.length=Q(),l}function Ke(){return Je()||Qe()||Ze()||Xe()||xe()||Ye()||qe()}function qe(){return P("literal",t.literalColor,0)}function Je(){return P("hex",t.hexColor,1)}function xe(){return u(t.rgbColor,()=>({type:"rgb",value:M(U)}))}function Xe(){return u(t.rgbaColor,()=>({type:"rgba",value:M(U)}))}function Ye(){return u(t.varColor,()=>({type:"var",value:tr()}))}function Ze(){return u(t.hslColor,()=>{m(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=U();m(t.comma);let d=m(t.percentageValue);const b=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const I=d?d[1]:null;return(!b||!I)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,b,I]}})}function Qe(){return u(t.hslaColor,()=>{const l=U();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const b=c?c[1]:null;m(t.comma);const I=U();return(!d||!b)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[l,d,b,I]}})}function tr(){return m(t.variableName)[1]}function U(){return m(t.number)[1]}function Q(){return P("%",t.percentageValue,1)||er()||rr()||Se()}function er(){return P("position-keyword",t.positionKeywords,1)}function rr(){return u(t.calcValue,()=>{let l=1,c=0;for(;l>0&&c<e.length;){const b=e.charAt(c);b==="("?l++:b===")"&&l--,c++}l>0&&r("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return pt(c-1),{type:"calc",value:d}})}function Se(){return P("px",t.pixelValue,1)||P("em",t.emValue,1)}function P(l,c,d){const b=m(c);if(b)return{type:l,value:b[d]}}function m(l){let c,d;return d=/^\s+/.exec(e),d&&pt(d[0].length),c=l.exec(e),c&&pt(c[0].length),c}function pt(l){e=e.substr(l)}return function(l){return e=l.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}})();const It=x.parse.bind(x);var X=X||{};X.stringify=(function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),i=t.visit(e.style);return i&&(r+=" "+i),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,i=t.visit(r.length);return i&&(n+=" "+i),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(i,a){r+=t.visit(i),a<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}})();const Ge=X.stringify.bind(X);function jt(t){const e=t.length-1;return t.map((r,n)=>{const i=r.value;let a=A(n/e,3),s="#00000000";switch(r.type){case"rgb":s=S({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=S({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=S(r.value);break;case"hex":s=S(`#${r.value}`);break}switch(r.length?.type){case"%":a=Number(r.length.value)/100;break}return{offset:a,color:s}})}function Tt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:jt(t.colorStops)}}function Mt(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:jt(t.colorStops)}}function W(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Vt(t){return It(t).map(e=>{switch(e?.type){case"linear-gradient":return Tt(e);case"repeating-linear-gradient":return{...Tt(e),repeat:!0};case"radial-gradient":return Mt(e);case"repeating-radial-gradient":return{...Mt(e),repeat:!0};default:return}}).filter(Boolean)}function kt(t){let e;return typeof t=="string"?e={color:t}:e={...t},{color:S(e.color)}}function $t(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:r,...n}=Vt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}}return N(e,["linearGradient","radialGradient","rotateWithShape"])}function Wt(t){let e;return typeof t=="string"?e={image:t}:e={...t},N(e,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function Ht(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=S(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=S(e.backgroundColor),N(e,["preset","foregroundColor","backgroundColor"])}function Bt(t){return!h(t.color)}function Ut(t){return typeof t=="string"?Gt(t):Bt(t)}function Kt(t){return!h(t.image)&&W(t.image)||!!t.linearGradient||!!t.radialGradient}function qt(t){return typeof t=="string"?W(t):Kt(t)}function Jt(t){return!h(t.image)&&!W(t.image)}function xt(t){return typeof t=="string"?!W(t):Jt(t)}function Xt(t){return!h(t.preset)}function Yt(t){return typeof t=="string"?!1:Xt(t)}function E(t){const e=t&&typeof t=="object"?t.enabled:void 0;return Ut(t)?_({enabled:e,...kt(t)}):qt(t)?_({enabled:e,...$t(t)}):xt(t)?_({enabled:e,...Wt(t)}):Yt(t)?_({enabled:e,...Ht(t)}):{}}function Zt(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["fillWithShape"])}}function lt(){return{color:$,offsetX:0,offsetY:0,blurRadius:1}}function ut(t){return{...lt(),..._({...t,color:h(t.color)?$:S(t.color)})}}function Qt(){return{...lt(),scaleX:1,scaleY:1}}function te(t){return{...Qt(),...ut(t)}}function Ie(t){return t}function ee(t){return _({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:te(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:ut(t.innerShadow)})}function re(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["fillWithShape"])}}const je="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Te=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=je[r[t]&63];return e};const ne=()=>Te(10),ie=ne;function H(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function oe(t){return typeof t=="string"?{color:S(t)}:{...t,color:h(t.color)?$:S(t.color)}}function ae(){return{boxShadow:"none"}}function se(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function le(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ue(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ce(){return{...le(),...ue(),...ae(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function fe(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function de(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function he(){return{...fe(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function ge(){return{...de(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function pe(){return{...ge(),...he(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function T(t){return _({...t,color:h(t.color)?void 0:S(t.color),backgroundColor:h(t.backgroundColor)?void 0:S(t.backgroundColor),borderColor:h(t.borderColor)?void 0:S(t.borderColor),outlineColor:h(t.outlineColor)?void 0:S(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:S(t.shadowColor)})}function Me(){return{...ce(),...pe()}}const ct=/\r\n|\n\r|\n|\r/,Ve=new RegExp(`${ct.source}|<br\\/>`,"g"),ke=new RegExp(`^(${ct.source})$`),ft=`
|
|
2
|
-
`;function
|
|
1
|
+
(function(o,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(o=typeof globalThis<"u"?globalThis:o||self,j(o.modernIdoc={}))})(this,(function(o){"use strict";function j(t){return typeof t=="string"?{src:t}:t}var Ce={grad:.9,turn:360,rad:360/(2*Math.PI)},L=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},z=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},vt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},yt=function(t){return{r:z(t.r,0,255),g:z(t.g,0,255),b:z(t.b,0,255),a:z(t.a)}},tt=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},we=/^#([0-9a-f]{3,8})$/i,K=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},bt=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=Math.max(e,r,n),s=a-Math.min(e,r,n),u=s?a===e?(r-n)/s:a===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(u<0?u+6:u),s:a?s/a*100:0,v:a/255*100,a:i}},St=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var a=Math.floor(e),s=n*(1-r),u=n*(1-(e-a)*r),f=n*(1-(1-e+a)*r),g=a%6;return{r:255*[n,u,s,s,f,n][g],g:255*[f,n,n,u,s,s][g],b:255*[s,s,f,n,n,u][g],a:i}},_t=function(t){return{h:vt(t.h),s:z(t.s,0,100),l:z(t.l,0,100),a:z(t.a)}},Ct=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},wt=function(t){return St((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},V=function(t){return{h:(e=bt(t)).h,s:(i=(200-(r=e.s))*(n=e.v)/100)>0&&i<200?r*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,r,n,i},Pe=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ze=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ee=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pt={string:[[function(t){var e=we.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?v(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Oe.exec(t)||Ee.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:yt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=Pe.exec(t)||ze.exec(t);if(!e)return null;var r,n,i=_t({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Ce[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return wt(i)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=i===void 0?1:i;return L(e)&&L(r)&&L(n)?yt({r:Number(e),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,i=t.a,a=i===void 0?1:i;if(!L(e)||!L(r)||!L(n))return null;var s=_t({h:Number(e),s:Number(r),l:Number(n),a:Number(a)});return wt(s)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,i=t.a,a=i===void 0?1:i;if(!L(e)||!L(r)||!L(n))return null;var s=(function(u){return{h:vt(u.h),s:z(u.s,0,100),v:z(u.v,0,100),a:z(u.a)}})({h:Number(e),s:Number(r),v:Number(n),a:Number(a)});return St(s)},"hsv"]]},zt=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},Fe=function(t){return typeof t=="string"?zt(t.trim(),Pt.string):typeof t=="object"&&t!==null?zt(t,Pt.object):[null,void 0]},et=function(t,e){var r=V(t);return{h:r.h,s:z(r.s+100*e,0,100),l:r.l,a:r.a}},rt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Ot=function(t,e){var r=V(t);return{h:r.h,s:r.s,l:z(r.l+100*e,0,100),a:r.a}},Et=(function(){function t(e){this.parsed=Fe(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return v(rt(this.rgba),2)},t.prototype.isDark=function(){return rt(this.rgba)<.5},t.prototype.isLight=function(){return rt(this.rgba)>=.5},t.prototype.toHex=function(){return e=tt(this.rgba),r=e.r,n=e.g,i=e.b,s=(a=e.a)<1?K(v(255*a)):"","#"+K(r)+K(n)+K(i)+s;var e,r,n,i,a,s},t.prototype.toRgb=function(){return tt(this.rgba)},t.prototype.toRgbString=function(){return e=tt(this.rgba),r=e.r,n=e.g,i=e.b,(a=e.a)<1?"rgba("+r+", "+n+", "+i+", "+a+")":"rgb("+r+", "+n+", "+i+")";var e,r,n,i,a},t.prototype.toHsl=function(){return Ct(V(this.rgba))},t.prototype.toHslString=function(){return e=Ct(V(this.rgba)),r=e.h,n=e.s,i=e.l,(a=e.a)<1?"hsla("+r+", "+n+"%, "+i+"%, "+a+")":"hsl("+r+", "+n+"%, "+i+"%)";var e,r,n,i,a},t.prototype.toHsv=function(){return e=bt(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return D({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),D(et(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),D(et(this.rgba,-e))},t.prototype.grayscale=function(){return D(et(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),D(Ot(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),D(Ot(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?D({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):v(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=V(this.rgba);return typeof e=="number"?D({h:e,s:r.s,l:r.l,a:r.a}):v(r.h)},t.prototype.isEqual=function(e){return this.toHex()===D(e).toHex()},t})(),D=function(t){return t instanceof Et?t:new Et(t)};class De{eventListeners=new Map;addEventListener(e,r,n){const i={value:r,options:n},a=this.eventListeners.get(e);return a?Array.isArray(a)?a.push(i):this.eventListeners.set(e,[a,i]):this.eventListeners.set(e,i),this}removeEventListener(e,r,n){if(!r)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let s=0,u=i.length;s<u;s++){const f=i[s];(f.value!==r||typeof n=="object"&&n?.once&&(typeof f.options=="boolean"||!f.options?.once))&&a.push(f)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===r&&(typeof n=="boolean"||!n?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...r){const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let i=n.length,a=0;a<i;a++){const s=n[a];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.value.apply(this,r)}else typeof n.options=="object"&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,r);return!0}else return!1}on(e,r,n){return this.addEventListener(e,r,n)}once(e,r){return this.addEventListener(e,r,{once:!0})}off(e,r,n){return this.removeEventListener(e,r,n)}emit(e,...r){this.dispatchEvent(e,...r)}}function h(t){return t==null||t==="none"}function A(t,e=0,r=10**e){return Math.round(r*t)/r+0}function _(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>_(n,e)):t;const r={};for(const n in t){const i=t[n];i!=null&&(e?r[n]=_(i,e):r[n]=i)}return r}function N(t,e){const r={};return e.forEach(n=>{n in t&&(r[n]=t[n])}),r}function q(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const r=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!r.length||r.every(n=>t[n]===e[n])}return!1}function Ft(t,e,r){const n=e.length-1;if(n<0)return t===void 0?r:t;for(let i=0;i<n;i++){if(t==null)return r;t=t[e[i]]}return t==null||t[e[n]]===void 0?r:t[e[n]]}function Dt(t,e,r){const n=e.length-1;for(let i=0;i<n;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[n]]=r}function Lt(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Ft(t,e.split("."),r))}function At(t,e,r){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Dt(t,e.split("."),r)}class Nt{_observers=new Map;on(e,r){let n=this._observers.get(e);return n===void 0&&this._observers.set(e,n=new Set),n.add(r),this}once(e,r){const n=(...i)=>{this.off(e,n),r(...i)};return this.on(e,n),this}off(e,r){const n=this._observers.get(e);return n!==void 0&&(n.delete(r),n.size===0&&this._observers.delete(e)),this}emit(e,...r){return Array.from((this._observers.get(e)||new Map).values()).forEach(n=>n(...r)),this}destroy(){this._observers=new Map}}class Le{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const r=e.__v_raw;r&&(e=this._toRaw(r))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,r){return this._map.set(this._toRaw(e),this._toRaw(r)),this}}const nt=Symbol("properties"),Rt=Symbol("inited");function $(t){let e;if(Object.hasOwn(t,nt))e=t[nt];else{const r=Object.getPrototypeOf(t);e=new Map(r?$(r):void 0),t[nt]=e}return e}function it(t,e,r,n){const{alias:i,internalKey:a}=n,s=t[e];i?At(t,i,r):t[a]=r,t.onUpdateProperty?.(e,r,s)}function ot(t,e,r){const{alias:n,internalKey:i}=r;let a;return n?a=Lt(t,n):a=t[i],a=a??at(t,e,r),a}function at(t,e,r){const{default:n,fallback:i}=r;let a;if(n!==void 0&&!t[Rt]){t[Rt]=!0;const s=typeof n=="function"?n():n;s!==void 0&&(t[e]=s,a=s)}return a=a??(typeof i=="function"?i():i),a}function st(t,e){function r(){return typeof this.getProperty<"u"?this.getProperty(t):ot(this,t,e)}function n(i){typeof this.setProperty<"u"?this.setProperty(t,i):it(this,t,i,e)}return{get:r,set:n}}function Gt(t,e,r={}){const n={...r,internalKey:Symbol(e)};$(t).set(e,n);const i=st(e,n);Object.defineProperty(t.prototype,e,{get(){return i.get.call(this)},set(a){i.set.call(this,a)},configurable:!0,enumerable:!0})}function Ae(t){return function(e,r){if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Gt(e.constructor,r,t)}}function Ne(t={}){return function(e,r){const n=r.name;if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i={...t,internalKey:Symbol(n)},a=st(n,i);return{init(s){return $(this.constructor).set(n,i),a.set.call(this,s),s},get(){return a.get.call(this)},set(s){a.set.call(this,s)}}}}class Re extends Nt{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e){const r=this.getPropertyDeclaration(e);if(r){if(r.internal||r.alias)return ot(this,e,r);{let n;return this._propertyAccessor?.getProperty?n=this._propertyAccessor.getProperty(e):n=this._properties.get(e),n??at(this,e,r)}}}setProperty(e,r){const n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)it(this,e,r,n);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,r),this._properties.set(e,r),this.onUpdateProperty?.(e,r,i)}}getProperties(e){const r={};for(const[n,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(n))&&(r[n]=this.getProperty(n));return r}setProperties(e){if(e&&typeof e=="object")for(const r in e)this.setProperty(r,e[r]);return this}resetProperties(){for(const[e,r]of this.getPropertyDeclarations())this.setProperty(e,typeof r.default=="function"?r.default():r.default);return this}getPropertyDeclarations(){return $(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const r=this.getPropertyDeclarations();this._propertyAccessor=void 0;const n={};return r.forEach((i,a)=>{n[a]=this.getProperty(a)}),this._propertyAccessor=e,r.forEach((i,a)=>{const s=this.getProperty(a),u=n[a];s!==void 0&&!Object.is(s,u)&&(this.setProperty(a,s),!i.internal&&!i.alias&&this.requestUpdate(a,s,u))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,r,n){Object.is(r,n)||this.requestUpdate(e,r,n)}requestUpdate(e,r,n){e!==void 0&&(this._updatedProperties.set(e,n),this._changedProperties.add(e),this._updateProperty(e,r,n),this.emit("updateProperty",e,r,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,r,n){}toJSON(){const e={};return this._properties.forEach((r,n)=>{r!==void 0&&(r&&typeof r=="object"?"toJSON"in r&&typeof r.toJSON=="function"?e[n]=r.toJSON():Array.isArray(r)?e[n]=[...r]:e[n]={...r}:e[n]=r)}),e}clone(){return new this.constructor(this.toJSON())}}function lt(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,D(e)}function Ge(t){return{r:A(t.r),g:A(t.g),b:A(t.b),a:A(t.a,3)}}function J(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const k="#000000FF";function It(t){return lt(t).isValid()}function S(t,e=!1){const r=lt(t);if(!r.isValid()){if(typeof t=="string")return t;const u=`Failed to normalizeColor ${t}`;if(e)throw new Error(u);return console.warn(u),k}const{r:n,g:i,b:a,a:s}=Ge(r.rgba);return`#${J(n)}${J(i)}${J(a)}${J(A(s*255))}`}var X=X||{};X.parse=(function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(l){const c=new Error(`${e}: ${l}`);throw c.source=e,c}function n(){const l=i();return e.length>0&&r("Invalid input not EOF"),l}function i(){return M(a)}function a(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,p)||s("repeating-radial-gradient",t.repeatingRadialGradient,p)}function s(l,c,d){return u(c,b=>{const I=d();return I&&(m(t.comma)||r("Missing comma before color stops")),{type:l,orientation:I,colorStops:M(pt)}})}function u(l,c){const d=m(l);if(d){m(t.startCall)||r("Missing (");const b=c(d);return m(t.endCall)||r("Missing )"),b}}function f(){const l=g();if(l)return l;const c=P("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:y()}function g(){return P("directional",t.sideOrCorner,1)}function y(){return P("angular",t.angleValue,1)||P("angular",t.radianValue,1)}function p(){let l,c=C(),d;return c&&(l=[],l.push(c),d=e,m(t.comma)&&(c=C(),c?l.push(c):e=d)),l}function C(){let l=w()||R();if(l)l.at=F();else{const c=O();if(c){l=c;const d=F();d&&(l.at=d)}else{const d=F();if(d)l={type:"default-radial",at:d};else{const b=G();b&&(l={type:"default-radial",at:b})}}}return l}function w(){const l=P("shape",/^(circle)/i,0);return l&&(l.style=_e()||O()),l}function R(){const l=P("shape",/^(ellipse)/i,0);return l&&(l.style=G()||Q()||O()),l}function O(){return P("extent-keyword",t.extentKeywords,1)}function F(){if(P("position",/^at/,0)){const l=G();return l||r("Missing positioning value"),l}}function G(){const l=B();if(l.x||l.y)return{type:"position",value:l}}function B(){return{x:Q(),y:Q()}}function M(l){let c=l();const d=[];if(c)for(d.push(c);m(t.comma);)c=l(),c?d.push(c):r("One extra comma");return d}function pt(){const l=qe();return l||r("Expected color definition"),l.length=Q(),l}function qe(){return Xe()||tr()||Qe()||xe()||Ye()||Ze()||Je()}function Je(){return P("literal",t.literalColor,0)}function Xe(){return P("hex",t.hexColor,1)}function Ye(){return u(t.rgbColor,()=>({type:"rgb",value:M(U)}))}function xe(){return u(t.rgbaColor,()=>({type:"rgba",value:M(U)}))}function Ze(){return u(t.varColor,()=>({type:"var",value:er()}))}function Qe(){return u(t.hslColor,()=>{m(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=U();m(t.comma);let d=m(t.percentageValue);const b=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const I=d?d[1]:null;return(!b||!I)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,b,I]}})}function tr(){return u(t.hslaColor,()=>{const l=U();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const b=c?c[1]:null;m(t.comma);const I=U();return(!d||!b)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[l,d,b,I]}})}function er(){return m(t.variableName)[1]}function U(){return m(t.number)[1]}function Q(){return P("%",t.percentageValue,1)||rr()||nr()||_e()}function rr(){return P("position-keyword",t.positionKeywords,1)}function nr(){return u(t.calcValue,()=>{let l=1,c=0;for(;l>0&&c<e.length;){const b=e.charAt(c);b==="("?l++:b===")"&&l--,c++}l>0&&r("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return mt(c-1),{type:"calc",value:d}})}function _e(){return P("px",t.pixelValue,1)||P("em",t.emValue,1)}function P(l,c,d){const b=m(c);if(b)return{type:l,value:b[d]}}function m(l){let c,d;return d=/^\s+/.exec(e),d&&mt(d[0].length),c=l.exec(e),c&&mt(c[0].length),c}function mt(l){e=e.substr(l)}return function(l){return e=l.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}})();const jt=X.parse.bind(X);var Y=Y||{};Y.stringify=(function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),i=t.visit(e.style);return i&&(r+=" "+i),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,i=t.visit(r.length);return i&&(n+=" "+i),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(i,a){r+=t.visit(i),a<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}})();const Ie=Y.stringify.bind(Y);function Tt(t){const e=t.length-1;return t.map((r,n)=>{const i=r.value;let a=A(n/e,3),s="#00000000";switch(r.type){case"rgb":s=S({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=S({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=S(r.value);break;case"hex":s=S(`#${r.value}`);break}switch(r.length?.type){case"%":a=Number(r.length.value)/100;break}return{offset:a,color:s}})}function Mt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Tt(t.colorStops)}}function Vt(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Tt(t.colorStops)}}function W(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function $t(t){return jt(t).map(e=>{switch(e?.type){case"linear-gradient":return Mt(e);case"repeating-linear-gradient":return{...Mt(e),repeat:!0};case"radial-gradient":return Vt(e);case"repeating-radial-gradient":return{...Vt(e),repeat:!0};default:return}}).filter(Boolean)}function kt(t){let e;return typeof t=="string"?e={color:t}:e={...t},{color:S(e.color)}}function Wt(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:r,...n}=$t(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}}return N(e,["linearGradient","radialGradient","rotateWithShape"])}function Ht(t){let e;return typeof t=="string"?e={image:t}:e={...t},N(e,["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"])}function Bt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=S(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=S(e.backgroundColor),N(e,["preset","foregroundColor","backgroundColor"])}function Ut(t){return!h(t.color)}function Kt(t){return typeof t=="string"?It(t):Ut(t)}function qt(t){return!h(t.image)&&W(t.image)||!!t.linearGradient||!!t.radialGradient}function Jt(t){return typeof t=="string"?W(t):qt(t)}function Xt(t){return!h(t.image)&&!W(t.image)}function Yt(t){return typeof t=="string"?!W(t):Xt(t)}function xt(t){return!h(t.preset)}function Zt(t){return typeof t=="string"?!1:xt(t)}function E(t){const e=t&&typeof t=="object"?t.enabled:void 0;return Kt(t)?_({enabled:e,...kt(t)}):Jt(t)?_({enabled:e,...Wt(t)}):Yt(t)?_({enabled:e,...Ht(t)}):Zt(t)?_({enabled:e,...Bt(t)}):{}}function Qt(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["fillWithShape"])}}function ut(){return{color:k,offsetX:0,offsetY:0,blurRadius:1}}function ct(t){return{...ut(),..._({...t,color:h(t.color)?k:S(t.color)})}}function te(){return{...ut(),scaleX:1,scaleY:1}}function ee(t){return{...te(),...ct(t)}}function je(t){return t}function re(t){return _({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:ee(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:ct(t.innerShadow)})}function ne(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["fillWithShape"])}}const Te="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Me=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Te[r[t]&63];return e};const ie=()=>Me(10),oe=ie;function H(t){return typeof t=="string"?{...E(t)}:{...E(t),...N(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ae(t){return typeof t=="string"?{color:S(t)}:{...t,color:h(t.color)?k:S(t.color)}}function se(){return{boxShadow:"none"}}function le(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function ue(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ce(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function fe(){return{...ue(),...ce(),...se(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function de(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function he(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ge(){return{...de(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function pe(){return{...he(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function me(){return{...pe(),...ge(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function T(t){return _({...t,color:h(t.color)?void 0:S(t.color),backgroundColor:h(t.backgroundColor)?void 0:S(t.backgroundColor),borderColor:h(t.borderColor)?void 0:S(t.borderColor),outlineColor:h(t.outlineColor)?void 0:S(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:S(t.shadowColor)})}function Ve(){return{...fe(),...me()}}const ft=/\r\n|\n\r|\n|\r/,$e=new RegExp(`${ft.source}|<br\\/>`,"g"),ke=new RegExp(`^(${ft.source})$`),dt=`
|
|
2
|
+
`;function We(t){return ft.test(t)}function ht(t){return ke.test(t)}function ve(t){return t.replace($e,dt)}function x(t){const e=[];function r(){return e[e.length-1]}function n(u,f,g){const y=u?T(u):{},p=f?E(f):void 0,C=g?H(g):void 0,w=_({...y,fill:p,outline:C,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=w:e.push(w),w}function i(u="",f,g,y){const p=f?T(f):{},C=g?E(g):void 0,w=y?H(y):void 0;Array.from(u).forEach(R=>{if(ht(R)){const{fragments:O,fill:F,outline:G,...B}=r()||n();O.length||O.push(_({...p,fill:C,outline:w,content:dt})),n(B,F,G)}else{const O=r()||n(),F=O.fragments[O.fragments.length-1];if(F){const{content:G,fill:B,outline:M,...pt}=F;if(q(C,B)&&q(w,M)&&q(p,pt)){F.content=`${G}${R}`;return}}O.fragments.push(_({...p,fill:C,outline:w,content:R}))}})}(Array.isArray(t)?t:[t]).forEach(u=>{if(typeof u=="string")n(),i(u);else if(gt(u)){const{content:f,fill:g,outline:y,...p}=u;n(p,g,y),i(f)}else if(ye(u)){const{fragments:f,fill:g,outline:y,...p}=u;n(p,g,y),f.forEach(C=>{const{content:w,fill:R,outline:O,...F}=C;i(w,F,R,O)})}else Array.isArray(u)?(n(),u.forEach(f=>{if(typeof f=="string")i(f);else if(gt(f)){const{content:g,fill:y,outline:p,...C}=f;i(g,C,y,p)}})):console.warn("Failed to parse text content",u)});const s=r();return s&&!s.fragments.length&&s.fragments.push({content:""}),e}function ye(t){return t&&typeof t=="object"&&"fragments"in t&&Array.isArray(t.fragments)}function gt(t){return t&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function be(t){return typeof t=="string"||Array.isArray(t)?{content:x(t)}:_({...t,content:x(t.content??""),style:t.style?T(t.style):void 0,effects:t.effects?t.effects.map(e=>T(e)):void 0,measureDom:t.measureDom,fonts:t.fonts,fill:t.fill?E(t.fill):void 0,outline:t.outline?H(t.outline):void 0})}function He(t){return x(t).map(e=>{const r=ve(e.fragments.flatMap(n=>n.content).join(""));return ht(r)?"":r}).join(dt)}function Se(t){return typeof t=="string"?{src:t}:t}function Z(t){return _({...t,id:t.id??oe(),style:h(t.style)?void 0:T(t.style),text:h(t.text)?void 0:be(t.text),background:h(t.background)?void 0:Qt(t.background),shape:h(t.shape)?void 0:le(t.shape),fill:h(t.fill)?void 0:E(t.fill),outline:h(t.outline)?void 0:H(t.outline),foreground:h(t.foreground)?void 0:ne(t.foreground),shadow:h(t.shadow)?void 0:ae(t.shadow),video:h(t.video)?void 0:Se(t.video),audio:h(t.audio)?void 0:j(t.audio),effect:h(t.effect)?void 0:re(t.effect),children:t.children?.map(e=>Z(e))})}function Be(t){return Z(t)}function Ue(t){const e={};for(const r in t.children){const n=Z(t.children[r]);delete n.children,e[r]=n}return{...t,children:e}}function Ke(t){const{children:e,...r}=t;function n(f){const{parentId:g,childrenIds:y,...p}=f;return{...p,children:[]}}const i={},a=[],s={...r,children:a};function u(f){if(!e[f]||i[f])return;const g=e[f],y=n(g);i[f]=y;const p=g.parentId;if(p){u(p);const C=e[p],w=i[p];if(!w)return;C?.childrenIds&&w?.children&&(w.children[C.childrenIds.indexOf(f)]=y)}else a.push(y)}for(const f in e)u(f);return s}o.EventEmitter=De,o.Observable=Nt,o.RawWeakMap=Le,o.Reactivable=Re,o.clearUndef=_,o.defaultColor=k,o.defineProperty=Gt,o.flatDocumentToDocument=Ke,o.getDeclarations=$,o.getDefaultElementStyle=fe,o.getDefaultHighlightStyle=de,o.getDefaultInnerShadow=ut,o.getDefaultLayoutStyle=ue,o.getDefaultListStyleStyle=he,o.getDefaultOuterShadow=te,o.getDefaultShadowStyle=se,o.getDefaultStyle=Ve,o.getDefaultTextInlineStyle=ge,o.getDefaultTextLineStyle=pe,o.getDefaultTextStyle=me,o.getDefaultTransformStyle=ce,o.getNestedValue=Ft,o.getObjectValueByPath=Lt,o.getPropertyDescriptor=st,o.hasCRLF=We,o.idGenerator=oe,o.isCRLF=ht,o.isColor=It,o.isColorFill=Kt,o.isColorFillObject=Ut,o.isEqualObject=q,o.isFragmentObject=gt,o.isGradient=W,o.isGradientFill=Jt,o.isGradientFillObject=qt,o.isImageFill=Yt,o.isImageFillObject=Xt,o.isNone=h,o.isParagraphObject=ye,o.isPresetFill=Zt,o.isPresetFillObject=xt,o.nanoid=ie,o.normalizeAudio=j,o.normalizeBackground=Qt,o.normalizeCRLF=ve,o.normalizeColor=S,o.normalizeColorFill=kt,o.normalizeDocument=Be,o.normalizeEffect=re,o.normalizeElement=Z,o.normalizeFill=E,o.normalizeFlatDocument=Ue,o.normalizeForeground=ne,o.normalizeGradient=$t,o.normalizeGradientFill=Wt,o.normalizeImageFill=Ht,o.normalizeInnerShadow=ct,o.normalizeOuterShadow=ee,o.normalizeOutline=H,o.normalizePresetFill=Bt,o.normalizeShadow=ae,o.normalizeShape=le,o.normalizeSoftEdge=je,o.normalizeStyle=T,o.normalizeText=be,o.normalizeTextContent=x,o.normalizeVideo=Se,o.parseColor=lt,o.parseGradient=jt,o.pick=N,o.property=Ae,o.property2=Ne,o.propertyOffsetDefaultValue=at,o.propertyOffsetGet=ot,o.propertyOffsetSet=it,o.round=A,o.setNestedValue=Dt,o.setObjectValueByPath=At,o.stringifyGradient=Ie,o.textContentToString=He,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -277,8 +277,6 @@ function propertyOffsetSet(target, key, newValue, declaration) {
|
|
|
277
277
|
}
|
|
278
278
|
function propertyOffsetGet(target, key, declaration) {
|
|
279
279
|
const {
|
|
280
|
-
default: _default,
|
|
281
|
-
fallback,
|
|
282
280
|
alias,
|
|
283
281
|
internalKey
|
|
284
282
|
} = declaration;
|
|
@@ -288,8 +286,16 @@ function propertyOffsetGet(target, key, declaration) {
|
|
|
288
286
|
} else {
|
|
289
287
|
result = target[internalKey];
|
|
290
288
|
}
|
|
291
|
-
result = result ?? (
|
|
292
|
-
|
|
289
|
+
result = result ?? propertyOffsetDefaultValue(target, key, declaration);
|
|
290
|
+
return result;
|
|
291
|
+
}
|
|
292
|
+
function propertyOffsetDefaultValue(target, key, declaration) {
|
|
293
|
+
const {
|
|
294
|
+
default: _default,
|
|
295
|
+
fallback
|
|
296
|
+
} = declaration;
|
|
297
|
+
let result;
|
|
298
|
+
if (_default !== void 0 && !target[initedSymbol]) {
|
|
293
299
|
target[initedSymbol] = true;
|
|
294
300
|
const defaultValue = typeof _default === "function" ? _default() : _default;
|
|
295
301
|
if (defaultValue !== void 0) {
|
|
@@ -297,6 +303,7 @@ function propertyOffsetGet(target, key, declaration) {
|
|
|
297
303
|
result = defaultValue;
|
|
298
304
|
}
|
|
299
305
|
}
|
|
306
|
+
result = result ?? (typeof fallback === "function" ? fallback() : fallback);
|
|
300
307
|
return result;
|
|
301
308
|
}
|
|
302
309
|
function getPropertyDescriptor(key, declaration) {
|
|
@@ -386,17 +393,19 @@ class Reactivable extends Observable {
|
|
|
386
393
|
isDirty(key) {
|
|
387
394
|
return key ? this._updatedProperties.has(key) : this._updatedProperties.size > 0;
|
|
388
395
|
}
|
|
389
|
-
getProperty(key
|
|
396
|
+
getProperty(key) {
|
|
390
397
|
const declaration = this.getPropertyDeclaration(key);
|
|
391
398
|
if (declaration) {
|
|
392
399
|
if (declaration.internal || declaration.alias) {
|
|
393
400
|
return propertyOffsetGet(this, key, declaration);
|
|
394
401
|
} else {
|
|
402
|
+
let result;
|
|
395
403
|
if (this._propertyAccessor?.getProperty) {
|
|
396
|
-
|
|
404
|
+
result = this._propertyAccessor.getProperty(key);
|
|
397
405
|
} else {
|
|
398
|
-
|
|
406
|
+
result = this._properties.get(key);
|
|
399
407
|
}
|
|
408
|
+
return result ?? propertyOffsetDefaultValue(this, key, declaration);
|
|
400
409
|
}
|
|
401
410
|
}
|
|
402
411
|
return void 0;
|
|
@@ -1850,4 +1859,4 @@ function flatDocumentToDocument(flatDoc) {
|
|
|
1850
1859
|
return doc;
|
|
1851
1860
|
}
|
|
1852
1861
|
|
|
1853
|
-
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
|
1862
|
+
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, propertyOffsetDefaultValue, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|