sheetom 0.1.0-rc.9 → 0.1.1

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.d.cts CHANGED
@@ -1,6 +1,30 @@
1
1
  //#region src/diagnostics.d.ts
2
2
  /** Stable machine-readable codes emitted by opt-in mutation diagnostics. */
3
- type SheetOMDiagnosticCode = "INVALID_PRIORITY" | "INVALID_PROPERTY_VALUE" | "UNSUPPORTED_SHORTHAND_VALUE";
3
+ type SheetOMMutationDiagnosticCode = "INVALID_PRIORITY" | "INVALID_PROPERTY_VALUE" | "UNSUPPORTED_SHORTHAND_VALUE";
4
+ type SheetOMSerializationDiagnosticCode = "UNREPRESENTABLE_PENDING_SHORTHAND";
5
+ type SheetOMDiagnosticCode = SheetOMMutationDiagnosticCode | SheetOMSerializationDiagnosticCode;
6
+ /** A structured explanation for an ignored mutation. */
7
+ interface SheetOMMutationDiagnostic {
8
+ code: SheetOMMutationDiagnosticCode;
9
+ severity: "warning";
10
+ operation: "setProperty";
11
+ message: string;
12
+ property: string;
13
+ input: string;
14
+ location: null;
15
+ }
16
+ /** A structured explanation for a best-effort serialization recovery. */
17
+ interface SheetOMSerializationDiagnostic {
18
+ code: SheetOMSerializationDiagnosticCode;
19
+ severity: "warning";
20
+ operation: "serialize";
21
+ message: string;
22
+ property: string;
23
+ input: "";
24
+ location: null;
25
+ conflictingLonghands: readonly string[];
26
+ }
27
+ type SheetOMDiagnostic = SheetOMMutationDiagnostic | SheetOMSerializationDiagnostic;
4
28
  //#endregion
5
29
  //#region src/generated/css-style-declaration-properties.d.ts
6
30
  /** Named CSS properties supported by the pinned Chromium compatibility baseline. */
@@ -728,17 +752,36 @@ interface SheetOMResourceBudget {
728
752
  maxDeclarationsPerBlock?: number;
729
753
  }
730
754
  //#endregion
755
+ //#region src/serialization-error.d.ts
756
+ type SheetOMSerializationErrorCode = "UNREPRESENTABLE_PENDING_SHORTHAND";
757
+ /** A reparsable stylesheet cannot faithfully represent the current CSSOM state. */
758
+ declare class SheetOMSerializationError extends Error {
759
+ readonly code: SheetOMSerializationErrorCode;
760
+ readonly shorthand: string;
761
+ readonly conflictingLonghands: readonly string[];
762
+ constructor(shorthand: string, conflictingLonghands: readonly string[], options?: ErrorOptions);
763
+ }
764
+ //#endregion
731
765
  //#region src/index.d.ts
732
- /** A structured explanation for an ignored or recovered mutation. */
733
- interface SheetOMDiagnostic {
734
- code: SheetOMDiagnosticCode;
735
- severity: "warning";
736
- operation: "setProperty";
737
- message: string;
766
+ /** One ordered declaration mutation executed by SheetOM's engine extension. */
767
+ type CSSDeclarationMutation = {
768
+ kind: "set";
738
769
  property: string;
739
- input: string;
740
- location: null;
741
- }
770
+ value: string | null;
771
+ priority?: string | null;
772
+ } | {
773
+ kind: "remove";
774
+ property: string;
775
+ };
776
+ /** The result at the matching index of an ordered declaration mutation batch. */
777
+ type CSSDeclarationMutationResult = {
778
+ kind: "set";
779
+ accepted: boolean;
780
+ diagnostic: SheetOMDiagnostic | null;
781
+ } | {
782
+ kind: "remove";
783
+ value: string;
784
+ };
742
785
  /** Options for a constructed SheetOM stylesheet. */
743
786
  interface CSSStyleSheetOptions {
744
787
  baseURL?: string;
@@ -946,7 +989,7 @@ declare class CSSStyleDeclaration {
946
989
  #private;
947
990
  readonly [index: number]: string | undefined;
948
991
  readonly parentRule: CSSRule;
949
- protected constructor(parentRule: CSSRule);
992
+ protected constructor(parentRule: CSSRule, initialCssText?: string);
950
993
  get cssText(): string;
951
994
  set cssText(value: string);
952
995
  get length(): number;
@@ -954,6 +997,8 @@ declare class CSSStyleDeclaration {
954
997
  getPropertyValue(name: string): string;
955
998
  getPropertyPriority(name: string): string;
956
999
  setProperty(name: string, value: string | null, priority?: string): void;
1000
+ /** Apply ordered declaration mutations through one engine boundary crossing. */
1001
+ applyMutations(mutations: readonly CSSDeclarationMutation[]): CSSDeclarationMutationResult[];
957
1002
  removeProperty(name: string): string;
958
1003
  }
959
1004
  /** A live `@font-face` descriptor rule. */
@@ -1126,11 +1171,13 @@ declare class CSSStyleSheet {
1126
1171
  replace(cssText: string): Promise<CSSStyleSheet>;
1127
1172
  /** Serialize current state as reparsable CSS without mutating live objects. */
1128
1173
  serialize(): string;
1129
- /** Drain opt-in mutation diagnostics without affecting CSSOM behavior. */
1174
+ /** Serialize current state only when its CSS semantics can be preserved exactly. */
1175
+ serializeStrict(): string;
1176
+ /** Drain opt-in mutation and serialization diagnostics without affecting CSSOM behavior. */
1130
1177
  takeDiagnostics(): SheetOMDiagnostic[];
1131
1178
  }
1132
1179
  /** Forgivingly parse an existing regular stylesheet without loading imports. */
1133
1180
  declare function parseStyleSheet(cssText: string, options?: ParseStyleSheetOptions): CSSStyleSheet;
1134
1181
  //#endregion
1135
- export { CSSConditionRule, CSSContainerRule, CSSCounterStyleRule, CSSFontFaceRule, CSSFontFeatureValuesMap, CSSFontFeatureValuesRule, CSSFontPaletteValuesRule, CSSFunctionDeclarations, CSSFunctionDescriptors, CSSFunctionRule, CSSGroupingRule, CSSImportRule, CSSKeyframeRule, CSSKeyframesRule, CSSLayerBlockRule, CSSLayerStatementRule, CSSMarginRule, CSSMediaRule, CSSNamespaceRule, CSSNestedDeclarations, CSSPageRule, CSSPositionTryRule, CSSPropertyRule, CSSRule, CSSRuleList, CSSScopeRule, CSSStartingStyleRule, CSSStyleDeclaration, CSSStyleRule, CSSStyleSheet, CSSStyleSheetOptions, CSSSupportsRule, CSSViewTransitionRule, FunctionParameter, MediaList, ParseStyleSheetOptions, SheetOMDiagnostic, type SheetOMDiagnosticCode, type SheetOMResourceBudget, parseStyleSheet };
1182
+ export { CSSConditionRule, CSSContainerRule, CSSCounterStyleRule, CSSDeclarationMutation, CSSDeclarationMutationResult, CSSFontFaceRule, CSSFontFeatureValuesMap, CSSFontFeatureValuesRule, CSSFontPaletteValuesRule, CSSFunctionDeclarations, CSSFunctionDescriptors, CSSFunctionRule, CSSGroupingRule, CSSImportRule, CSSKeyframeRule, CSSKeyframesRule, CSSLayerBlockRule, CSSLayerStatementRule, CSSMarginRule, CSSMediaRule, CSSNamespaceRule, CSSNestedDeclarations, CSSPageRule, CSSPositionTryRule, CSSPropertyRule, CSSRule, CSSRuleList, CSSScopeRule, CSSStartingStyleRule, CSSStyleDeclaration, CSSStyleRule, CSSStyleSheet, CSSStyleSheetOptions, CSSSupportsRule, CSSViewTransitionRule, FunctionParameter, MediaList, ParseStyleSheetOptions, type SheetOMDiagnostic, type SheetOMDiagnosticCode, type SheetOMMutationDiagnostic, type SheetOMMutationDiagnosticCode, type SheetOMResourceBudget, type SheetOMSerializationDiagnostic, type SheetOMSerializationDiagnosticCode, SheetOMSerializationError, type SheetOMSerializationErrorCode, parseStyleSheet };
1136
1183
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,30 @@
1
1
  //#region src/diagnostics.d.ts
2
2
  /** Stable machine-readable codes emitted by opt-in mutation diagnostics. */
3
- type SheetOMDiagnosticCode = "INVALID_PRIORITY" | "INVALID_PROPERTY_VALUE" | "UNSUPPORTED_SHORTHAND_VALUE";
3
+ type SheetOMMutationDiagnosticCode = "INVALID_PRIORITY" | "INVALID_PROPERTY_VALUE" | "UNSUPPORTED_SHORTHAND_VALUE";
4
+ type SheetOMSerializationDiagnosticCode = "UNREPRESENTABLE_PENDING_SHORTHAND";
5
+ type SheetOMDiagnosticCode = SheetOMMutationDiagnosticCode | SheetOMSerializationDiagnosticCode;
6
+ /** A structured explanation for an ignored mutation. */
7
+ interface SheetOMMutationDiagnostic {
8
+ code: SheetOMMutationDiagnosticCode;
9
+ severity: "warning";
10
+ operation: "setProperty";
11
+ message: string;
12
+ property: string;
13
+ input: string;
14
+ location: null;
15
+ }
16
+ /** A structured explanation for a best-effort serialization recovery. */
17
+ interface SheetOMSerializationDiagnostic {
18
+ code: SheetOMSerializationDiagnosticCode;
19
+ severity: "warning";
20
+ operation: "serialize";
21
+ message: string;
22
+ property: string;
23
+ input: "";
24
+ location: null;
25
+ conflictingLonghands: readonly string[];
26
+ }
27
+ type SheetOMDiagnostic = SheetOMMutationDiagnostic | SheetOMSerializationDiagnostic;
4
28
  //#endregion
5
29
  //#region src/generated/css-style-declaration-properties.d.ts
6
30
  /** Named CSS properties supported by the pinned Chromium compatibility baseline. */
@@ -728,17 +752,36 @@ interface SheetOMResourceBudget {
728
752
  maxDeclarationsPerBlock?: number;
729
753
  }
730
754
  //#endregion
755
+ //#region src/serialization-error.d.ts
756
+ type SheetOMSerializationErrorCode = "UNREPRESENTABLE_PENDING_SHORTHAND";
757
+ /** A reparsable stylesheet cannot faithfully represent the current CSSOM state. */
758
+ declare class SheetOMSerializationError extends Error {
759
+ readonly code: SheetOMSerializationErrorCode;
760
+ readonly shorthand: string;
761
+ readonly conflictingLonghands: readonly string[];
762
+ constructor(shorthand: string, conflictingLonghands: readonly string[], options?: ErrorOptions);
763
+ }
764
+ //#endregion
731
765
  //#region src/index.d.ts
732
- /** A structured explanation for an ignored or recovered mutation. */
733
- interface SheetOMDiagnostic {
734
- code: SheetOMDiagnosticCode;
735
- severity: "warning";
736
- operation: "setProperty";
737
- message: string;
766
+ /** One ordered declaration mutation executed by SheetOM's engine extension. */
767
+ type CSSDeclarationMutation = {
768
+ kind: "set";
738
769
  property: string;
739
- input: string;
740
- location: null;
741
- }
770
+ value: string | null;
771
+ priority?: string | null;
772
+ } | {
773
+ kind: "remove";
774
+ property: string;
775
+ };
776
+ /** The result at the matching index of an ordered declaration mutation batch. */
777
+ type CSSDeclarationMutationResult = {
778
+ kind: "set";
779
+ accepted: boolean;
780
+ diagnostic: SheetOMDiagnostic | null;
781
+ } | {
782
+ kind: "remove";
783
+ value: string;
784
+ };
742
785
  /** Options for a constructed SheetOM stylesheet. */
743
786
  interface CSSStyleSheetOptions {
744
787
  baseURL?: string;
@@ -946,7 +989,7 @@ declare class CSSStyleDeclaration {
946
989
  #private;
947
990
  readonly [index: number]: string | undefined;
948
991
  readonly parentRule: CSSRule;
949
- protected constructor(parentRule: CSSRule);
992
+ protected constructor(parentRule: CSSRule, initialCssText?: string);
950
993
  get cssText(): string;
951
994
  set cssText(value: string);
952
995
  get length(): number;
@@ -954,6 +997,8 @@ declare class CSSStyleDeclaration {
954
997
  getPropertyValue(name: string): string;
955
998
  getPropertyPriority(name: string): string;
956
999
  setProperty(name: string, value: string | null, priority?: string): void;
1000
+ /** Apply ordered declaration mutations through one engine boundary crossing. */
1001
+ applyMutations(mutations: readonly CSSDeclarationMutation[]): CSSDeclarationMutationResult[];
957
1002
  removeProperty(name: string): string;
958
1003
  }
959
1004
  /** A live `@font-face` descriptor rule. */
@@ -1126,11 +1171,13 @@ declare class CSSStyleSheet {
1126
1171
  replace(cssText: string): Promise<CSSStyleSheet>;
1127
1172
  /** Serialize current state as reparsable CSS without mutating live objects. */
1128
1173
  serialize(): string;
1129
- /** Drain opt-in mutation diagnostics without affecting CSSOM behavior. */
1174
+ /** Serialize current state only when its CSS semantics can be preserved exactly. */
1175
+ serializeStrict(): string;
1176
+ /** Drain opt-in mutation and serialization diagnostics without affecting CSSOM behavior. */
1130
1177
  takeDiagnostics(): SheetOMDiagnostic[];
1131
1178
  }
1132
1179
  /** Forgivingly parse an existing regular stylesheet without loading imports. */
1133
1180
  declare function parseStyleSheet(cssText: string, options?: ParseStyleSheetOptions): CSSStyleSheet;
1134
1181
  //#endregion
1135
- export { CSSConditionRule, CSSContainerRule, CSSCounterStyleRule, CSSFontFaceRule, CSSFontFeatureValuesMap, CSSFontFeatureValuesRule, CSSFontPaletteValuesRule, CSSFunctionDeclarations, CSSFunctionDescriptors, CSSFunctionRule, CSSGroupingRule, CSSImportRule, CSSKeyframeRule, CSSKeyframesRule, CSSLayerBlockRule, CSSLayerStatementRule, CSSMarginRule, CSSMediaRule, CSSNamespaceRule, CSSNestedDeclarations, CSSPageRule, CSSPositionTryRule, CSSPropertyRule, CSSRule, CSSRuleList, CSSScopeRule, CSSStartingStyleRule, CSSStyleDeclaration, CSSStyleRule, CSSStyleSheet, CSSStyleSheetOptions, CSSSupportsRule, CSSViewTransitionRule, FunctionParameter, MediaList, ParseStyleSheetOptions, SheetOMDiagnostic, type SheetOMDiagnosticCode, type SheetOMResourceBudget, parseStyleSheet };
1182
+ export { CSSConditionRule, CSSContainerRule, CSSCounterStyleRule, CSSDeclarationMutation, CSSDeclarationMutationResult, CSSFontFaceRule, CSSFontFeatureValuesMap, CSSFontFeatureValuesRule, CSSFontPaletteValuesRule, CSSFunctionDeclarations, CSSFunctionDescriptors, CSSFunctionRule, CSSGroupingRule, CSSImportRule, CSSKeyframeRule, CSSKeyframesRule, CSSLayerBlockRule, CSSLayerStatementRule, CSSMarginRule, CSSMediaRule, CSSNamespaceRule, CSSNestedDeclarations, CSSPageRule, CSSPositionTryRule, CSSPropertyRule, CSSRule, CSSRuleList, CSSScopeRule, CSSStartingStyleRule, CSSStyleDeclaration, CSSStyleRule, CSSStyleSheet, CSSStyleSheetOptions, CSSSupportsRule, CSSViewTransitionRule, FunctionParameter, MediaList, ParseStyleSheetOptions, type SheetOMDiagnostic, type SheetOMDiagnosticCode, type SheetOMMutationDiagnostic, type SheetOMMutationDiagnosticCode, type SheetOMResourceBudget, type SheetOMSerializationDiagnostic, type SheetOMSerializationDiagnosticCode, SheetOMSerializationError, type SheetOMSerializationErrorCode, parseStyleSheet };
1136
1183
  //# sourceMappingURL=index.d.ts.map