@master/css-schema 2.0.0-rc.88 → 3.0.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.
@@ -1,4 +1,2 @@
1
- //#region src/css-common.d.ts
2
1
  type Vendors = 'webkit' | 'moz' | 'ms' | 'o';
3
- //#endregion
4
2
  export { Vendors };
@@ -1,11 +1,8 @@
1
- import { MasterCSSManifestDefaultMode, MasterCSSManifestModeTrigger, MasterCSSManifestUtilityKind, MasterCSSManifestUtilityLayerName, MasterCSSManifestVariant } from "./manifest.js";
2
- //#region src/css-directives.d.ts
1
+ import { MasterCSSKeyframeDefinition } from "./keyframes.js";
2
+ import { MasterCSSMixinDefinition, MasterCSSMixinNode, MasterCSSMixinValue, MasterCSSUtilityDefinition } from "./mixin.js";
3
+ import { MasterCSSThemeNode } from "./manifest.js";
3
4
  type CSSDirectiveVariableValue = number | string | false | (number | string)[];
4
5
  type CSSDirectiveDeclarations = Record<string, string>;
5
- type CSSDirectiveLayerName = MasterCSSManifestUtilityLayerName;
6
- type CSSDirectiveModeTrigger = MasterCSSManifestModeTrigger;
7
- type CSSDirectiveDefaultMode = MasterCSSManifestDefaultMode;
8
- type CSSDirectiveVariantDefinitions = Pick<MasterCSSManifestVariant, 'token' | 'branches'>[];
9
6
  interface CSSDirectiveSourceRange {
10
7
  start: number;
11
8
  end: number;
@@ -33,107 +30,106 @@ declare class CSSDirectiveError extends Error {
33
30
  constructor(code: string, message: string, source?: CSSDirectiveSourceReference, related?: CSSDirectiveRelatedInformation[]);
34
31
  }
35
32
  declare function createCSSDirectiveSourceReference(file: string | undefined, range: CSSDirectiveSourceRange, source?: string): CSSDirectiveSourceReference;
36
- interface CSSDirectiveVariableDefinition {
37
- name?: string;
38
- value: CSSDirectiveVariableValue;
39
- mode?: string;
40
- inline?: boolean;
41
- static?: boolean;
42
- namespace?: string;
43
- key?: string;
44
- }
45
- type CSSDirectiveAnimationDefinitions = Record<string, Record<string, CSSDirectiveDeclarations>>;
46
- type CSSDirectiveAnimationOptions = Record<string, {
47
- static?: boolean;
48
- }>;
49
- type CSSDirectiveConditionPathEntry = {
50
- type: 'condition';
51
- value: string;
52
- } | {
53
- type: 'variant';
54
- token: string;
55
- };
56
- interface CSSDirectiveUtilityRuleDefinition {
57
- declarations: CSSDirectiveDeclarations;
58
- conditions?: string[];
59
- conditionPath?: CSSDirectiveConditionPathEntry[];
60
- selector?: string;
61
- }
62
- interface CSSDirectiveUtilityPatternDefinition {
63
- prefix: string;
64
- values: string[];
65
- valueMap?: Record<string, string>;
66
- }
67
- interface CSSDirectiveUtilityDynamicDefinition {
68
- key: string;
69
- variableAliasRefs?: string[];
70
- kind?: MasterCSSManifestUtilityKind;
71
- values?: string[];
72
- arbitrary?: boolean;
73
- }
74
- interface CSSDirectiveUtilityDefinition {
33
+ interface CSSCustomMediaDefinition {
75
34
  name: string;
76
- type?: 'static' | 'pattern' | 'dynamic';
77
- layer?: CSSDirectiveLayerName;
78
- pattern?: CSSDirectiveUtilityPatternDefinition;
79
- dynamic?: CSSDirectiveUtilityDynamicDefinition;
80
- declarations?: CSSDirectiveDeclarations;
81
- conditions?: string[];
82
- conditionPath?: CSSDirectiveConditionPathEntry[];
83
- rules?: CSSDirectiveUtilityRuleDefinition[];
35
+ query: string;
36
+ source?: CSSDirectiveSourceReference;
37
+ }
38
+ /** An `@custom-container` condition as written, before references expand. */
39
+ interface CSSCustomContainerDefinition {
40
+ name: string;
41
+ query: string;
42
+ source?: CSSDirectiveSourceReference;
84
43
  }
85
44
  interface CSSDirectiveManifestInput {
86
- variants?: CSSDirectiveVariantDefinitions;
87
- variables?: CSSDirectiveVariableDefinition[];
88
- utilities?: CSSDirectiveUtilityDefinition[];
89
- rootSize?: number;
90
- baseUnit?: number;
91
- defaultMode?: CSSDirectiveDefaultMode;
92
- scope?: string;
93
- important?: boolean;
94
- animations?: CSSDirectiveAnimationDefinitions;
95
- animationOptions?: CSSDirectiveAnimationOptions;
96
- modes?: string[];
97
- modeTrigger?: CSSDirectiveModeTrigger;
45
+ keyframes?: MasterCSSKeyframeDefinition[];
46
+ keyframeSafelist?: string[];
47
+ animationVariables?: Record<string, string[]>;
48
+ theme?: MasterCSSThemeNode[];
49
+ customMedia?: CSSCustomMediaDefinition[];
50
+ customContainers?: CSSCustomContainerDefinition[];
51
+ mixins?: MasterCSSMixinDefinition[];
52
+ utilities?: MasterCSSUtilityDefinition[];
98
53
  }
99
54
  interface CSSDirectiveExtractionPolicy {
100
55
  include: string[];
101
56
  exclude: string[];
102
57
  safelist: string[];
58
+ safelistKeyframes: string[];
103
59
  blocklist: (string | RegExp)[];
104
60
  preserveNative: boolean;
61
+ pruneNative: boolean;
105
62
  }
106
63
  interface CSSDirectiveReference {
107
64
  source: string;
108
65
  file?: string;
109
66
  }
110
- interface CSSDirectiveStyleComposeDefinition {
111
- type: 'compose';
67
+ interface CSSOrderedDeclaration {
68
+ property: string;
69
+ value: string;
70
+ source?: CSSDirectiveSourceReference;
71
+ }
72
+ interface CSSDirectiveStyleNativeDefinition {
73
+ type: 'native';
112
74
  order: number;
113
- className: string;
114
75
  selector: string;
76
+ declarations: CSSOrderedDeclaration[];
115
77
  source?: CSSDirectiveSourceReference;
116
- directiveSource?: CSSDirectiveSourceReference;
117
78
  selectorSource?: CSSDirectiveSourceReference;
79
+ /** The enclosing conditional and layer preludes, outermost first. */
118
80
  conditions?: string[];
119
- conditionPath?: CSSDirectiveConditionPathEntry[];
120
- layer?: CSSDirectiveLayerName;
121
- name?: string;
122
81
  }
123
- interface CSSDirectiveStyleNativeDefinition {
124
- type: 'native';
82
+ interface CSSDirectiveStyleApplyDefinition {
83
+ type: 'apply';
125
84
  order: number;
126
85
  selector: string;
127
- declarations: CSSDirectiveDeclarations;
128
- source?: CSSDirectiveSourceReference;
86
+ name: string;
87
+ arguments: MasterCSSMixinValue[];
88
+ contents?: MasterCSSMixinNode[];
129
89
  selectorSource?: CSSDirectiveSourceReference;
90
+ source?: CSSDirectiveSourceReference;
91
+ /** The enclosing conditional and layer preludes, outermost first. */
130
92
  conditions?: string[];
131
- conditionPath?: CSSDirectiveConditionPathEntry[];
132
- layer?: CSSDirectiveLayerName;
133
- name?: string;
134
93
  }
135
- type CSSDirectiveStyleDefinition = CSSDirectiveStyleComposeDefinition | CSSDirectiveStyleNativeDefinition;
94
+ type CSSDirectiveStyleDefinition = CSSDirectiveStyleApplyDefinition | CSSDirectiveStyleNativeDefinition;
95
+ /** Generated UTF-16 offset and its original authoring-source anchor. */
96
+ interface CSSOutputMapping {
97
+ generatedStart: number;
98
+ generatedEnd?: number;
99
+ source: CSSDirectiveSourceReference;
100
+ }
101
+ /** Rust output plan; pass it unchanged from parsing to directive lowering. */
102
+ interface CSSNativeOutput {
103
+ css: string;
104
+ mappings: CSSOutputMapping[];
105
+ slots: {
106
+ start: number;
107
+ end: number;
108
+ marker: string;
109
+ definitions: CSSDirectiveStyleDefinition[];
110
+ }[];
111
+ }
112
+ interface CSSDefinitionSource {
113
+ kind: 'utility' | 'mixin';
114
+ name: string;
115
+ identity: string;
116
+ replacedBy?: CSSDirectiveSourceReference;
117
+ source: CSSDirectiveSourceReference;
118
+ }
119
+ interface CSSDirectiveNotice {
120
+ code: string;
121
+ message: string;
122
+ source?: CSSDirectiveSourceReference | null;
123
+ }
136
124
  interface CSSDirectiveResult {
125
+ notices?: CSSDirectiveNotice[];
126
+ definitionSources?: CSSDefinitionSource[];
127
+ nativeOutput?: CSSNativeOutput;
128
+ outputMappings?: CSSOutputMapping[];
129
+ /** Serialized source map v3 for the final CSS, when produced by the stylesheet host. */
130
+ sourceMap?: string;
131
+ nativeMappings?: CSSOutputMapping[];
132
+ generatedMappings?: CSSOutputMapping[];
137
133
  manifestInput: CSSDirectiveManifestInput;
138
134
  extractionPolicy: CSSDirectiveExtractionPolicy;
139
135
  classNames: string[];
@@ -146,5 +142,4 @@ interface CSSDirectiveResult {
146
142
  references?: CSSDirectiveReference[];
147
143
  styleDefinitions?: CSSDirectiveStyleDefinition[];
148
144
  }
149
- //#endregion
150
- export { CSSDirectiveAnimationDefinitions, CSSDirectiveAnimationOptions, CSSDirectiveConditionPathEntry, CSSDirectiveDeclarations, CSSDirectiveDefaultMode, CSSDirectiveError, CSSDirectiveExtractionPolicy, CSSDirectiveLayerName, CSSDirectiveManifestInput, CSSDirectiveModeTrigger, CSSDirectiveReference, CSSDirectiveRelatedInformation, CSSDirectiveResult, CSSDirectiveSourceLocation, CSSDirectiveSourceRange, CSSDirectiveSourceReference, CSSDirectiveStyleComposeDefinition, CSSDirectiveStyleDefinition, CSSDirectiveStyleNativeDefinition, CSSDirectiveUtilityDefinition, CSSDirectiveUtilityDynamicDefinition, CSSDirectiveUtilityPatternDefinition, CSSDirectiveUtilityRuleDefinition, CSSDirectiveVariableDefinition, CSSDirectiveVariableValue, CSSDirectiveVariantDefinitions, createCSSDirectiveSourceReference };
145
+ export { CSSCustomContainerDefinition, CSSCustomMediaDefinition, CSSDefinitionSource, CSSDirectiveDeclarations, CSSDirectiveError, CSSDirectiveExtractionPolicy, CSSDirectiveManifestInput, CSSDirectiveNotice, CSSDirectiveReference, CSSDirectiveRelatedInformation, CSSDirectiveResult, CSSDirectiveSourceLocation, CSSDirectiveSourceRange, CSSDirectiveSourceReference, CSSDirectiveStyleApplyDefinition, CSSDirectiveStyleDefinition, CSSDirectiveStyleNativeDefinition, CSSDirectiveVariableValue, CSSNativeOutput, CSSOrderedDeclaration, CSSOutputMapping, createCSSDirectiveSourceReference };
@@ -1,4 +1,4 @@
1
- //#region src/css-directives.ts
1
+ // src/css-directives.ts
2
2
  var CSSDirectiveError = class extends Error {
3
3
  code;
4
4
  source;
@@ -33,5 +33,4 @@ function createCSSDirectiveSourceReference(file, range, source) {
33
33
  } } : {}
34
34
  };
35
35
  }
36
- //#endregion
37
36
  export { CSSDirectiveError, createCSSDirectiveSourceReference };
@@ -1,5 +1,4 @@
1
- import { MasterCSSManifestUtility, MasterCSSManifestUtilityLayerName, MasterCSSManifestVariableNumericValue } from "./manifest.js";
2
- //#region src/css-syntax.d.ts
1
+ import { MasterCSSManifestUtilityLayerName, MasterCSSManifestVariableNumericValue } from "./manifest.js";
3
2
  type ValueComponent = StringValueComponent | NumberValueComponent | FunctionValueComponent | VariableValueComponent | SeparatorValueComponent;
4
3
  interface StringValueComponent {
5
4
  text?: string;
@@ -39,20 +38,6 @@ interface SeparatorValueComponent {
39
38
  type: 'separator';
40
39
  value: string;
41
40
  }
42
- interface DefinedUtility {
43
- id: string;
44
- key?: string;
45
- keys: string[];
46
- matchers: {
47
- key?: RegExp;
48
- variable?: RegExp;
49
- value?: RegExp;
50
- arbitrary?: RegExp;
51
- };
52
- variables?: Map<string, Variable>;
53
- order: number;
54
- definition: MasterCSSManifestUtility;
55
- }
56
41
  type ExplicitUtilityLayerName = MasterCSSManifestUtilityLayerName;
57
42
  interface MediaFeatureComponent {
58
43
  type: string;
@@ -90,5 +75,4 @@ type Variable = VariableCommon & {
90
75
  value?: ResolvedVariableValue['value'];
91
76
  numeric?: MasterCSSManifestVariableNumericValue;
92
77
  };
93
- //#endregion
94
- export { DefinedUtility, ExplicitUtilityLayerName, FunctionValueComponent, MediaFeatureComponent, MediaQuery, NumberValueComponent, NumberVariable, ResolvedVariableValue, SeparatorValueComponent, StringValueComponent, StringVariable, ValueComponent, Variable, VariableValueComponent };
78
+ export { ExplicitUtilityLayerName, FunctionValueComponent, MediaFeatureComponent, MediaQuery, NumberValueComponent, NumberVariable, ResolvedVariableValue, SeparatorValueComponent, StringValueComponent, StringVariable, ValueComponent, Variable, VariableValueComponent };
@@ -0,0 +1,41 @@
1
+ declare const MASTER_CSS_DIAGNOSTIC_VERSION: 2;
2
+ type MasterCSSDiagnosticDomain = 'binding' | 'compiler' | 'engine' | 'integration' | 'language' | 'project' | 'runtime' | 'server' | 'tooling';
3
+ type MasterCSSDiagnosticSeverity = 'error' | 'warning' | 'information';
4
+ interface MasterCSSDiagnosticPosition {
5
+ line: number;
6
+ character: number;
7
+ }
8
+ interface MasterCSSDiagnosticRange {
9
+ start: MasterCSSDiagnosticPosition;
10
+ end: MasterCSSDiagnosticPosition;
11
+ }
12
+ interface MasterCSSDiagnostic {
13
+ readonly version: typeof MASTER_CSS_DIAGNOSTIC_VERSION;
14
+ readonly code: string;
15
+ readonly domain: MasterCSSDiagnosticDomain;
16
+ readonly phase?: 'match' | 'css-syntax' | 'css-value' | 'browser-support' | 'compiler';
17
+ readonly severity: MasterCSSDiagnosticSeverity;
18
+ readonly message: string;
19
+ readonly source?: string;
20
+ readonly range?: MasterCSSDiagnosticRange;
21
+ readonly notes?: readonly string[];
22
+ readonly help?: string;
23
+ }
24
+ interface MasterCSSErrorPayload {
25
+ readonly code: string;
26
+ readonly domain: MasterCSSDiagnosticDomain;
27
+ readonly message: string;
28
+ readonly diagnostics?: readonly MasterCSSDiagnostic[];
29
+ }
30
+ interface MasterCSSErrorOptions extends ErrorOptions {
31
+ diagnostics?: readonly MasterCSSDiagnostic[];
32
+ }
33
+ declare class MasterCSSError extends Error {
34
+ readonly code: string;
35
+ readonly domain: MasterCSSDiagnosticDomain;
36
+ readonly diagnostics: readonly MasterCSSDiagnostic[];
37
+ readonly payload: MasterCSSErrorPayload;
38
+ constructor(payload: MasterCSSErrorPayload, options?: MasterCSSErrorOptions);
39
+ toJSON(): MasterCSSErrorPayload;
40
+ }
41
+ export { MASTER_CSS_DIAGNOSTIC_VERSION, MasterCSSDiagnostic, MasterCSSDiagnosticDomain, MasterCSSDiagnosticPosition, MasterCSSDiagnosticRange, MasterCSSDiagnosticSeverity, MasterCSSError, MasterCSSErrorOptions, MasterCSSErrorPayload };
@@ -0,0 +1,35 @@
1
+ // src/diagnostics.ts
2
+ const MASTER_CSS_DIAGNOSTIC_VERSION = 2;
3
+ function freezeDiagnostic(diagnostic) {
4
+ return Object.freeze({
5
+ ...diagnostic,
6
+ ...diagnostic.range ? { range: Object.freeze({
7
+ start: Object.freeze({ ...diagnostic.range.start }),
8
+ end: Object.freeze({ ...diagnostic.range.end })
9
+ }) } : {},
10
+ ...diagnostic.notes ? { notes: Object.freeze([...diagnostic.notes]) } : {}
11
+ });
12
+ }
13
+ var MasterCSSError = class extends Error {
14
+ code;
15
+ domain;
16
+ diagnostics;
17
+ payload;
18
+ constructor(payload, options = {}) {
19
+ super(payload.message, options);
20
+ this.name = "MasterCSSError";
21
+ this.code = payload.code;
22
+ this.domain = payload.domain;
23
+ this.diagnostics = Object.freeze((options.diagnostics ?? payload.diagnostics ?? []).map(freezeDiagnostic));
24
+ this.payload = Object.freeze({
25
+ code: this.code,
26
+ domain: this.domain,
27
+ message: this.message,
28
+ ...this.diagnostics.length ? { diagnostics: this.diagnostics } : {}
29
+ });
30
+ }
31
+ toJSON() {
32
+ return this.payload;
33
+ }
34
+ };
35
+ export { MASTER_CSS_DIAGNOSTIC_VERSION, MasterCSSError };
@@ -0,0 +1,7 @@
1
+ /** Resource counts already emitted outside the current Rust engine session. */
2
+ interface MasterCSSEmittedGlobals {
3
+ variables?: Record<string, number>;
4
+ /** Counts keyed by definition ID, rather than animation name. */
5
+ keyframes?: Record<string, number>;
6
+ }
7
+ export { MasterCSSEmittedGlobals };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,35 +1,66 @@
1
1
  import { MasterCSSManifestUtilityLayerName } from "./manifest.js";
2
+ import { MasterCSSEmittedGlobals } from "./emitted-globals.js";
2
3
  import { UtilityType } from "./utility-type.js";
3
- //#region src/hydration-manifest.d.ts
4
4
  declare const MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID = "master-css-hydration-manifest";
5
5
  declare const MASTER_CSS_HYDRATION_MANIFEST_ATTR = "data-master-css-hydration-manifest";
6
6
  declare const MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE = "/_master-css/hydration/";
7
7
  declare const MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME = "master-css-hydration";
8
- interface MasterCSSRulePriorityIR {
9
- features?: [string, number, number][];
10
- selector: number;
8
+ interface MasterCSSConditionRange {
9
+ readonly domain: string;
10
+ readonly feature: string;
11
+ readonly unit: string;
12
+ readonly lower: {
13
+ readonly value: number;
14
+ readonly inclusive: boolean;
15
+ } | null;
16
+ readonly upper: {
17
+ readonly value: number;
18
+ readonly inclusive: boolean;
19
+ } | null;
11
20
  }
12
- interface MasterCSSGeneratedRuleNodeIR {
13
- text: string;
21
+ interface MasterCSSRulePriority {
22
+ /** Token values sort before raw values within the same cascade tier. */
23
+ readonly valuePriority?: -1 | 0;
24
+ /** Parsed declaration identity, independent of public aliases. */
25
+ readonly sortKey?: string;
26
+ readonly features: readonly MasterCSSConditionRange[];
27
+ readonly conditions?: readonly string[];
28
+ readonly selector: number;
14
29
  }
15
- interface MasterCSSGeneratedRuleIR {
16
- className: string;
17
- key: string;
18
- layer: MasterCSSManifestUtilityLayerName;
19
- type: UtilityType;
20
- sortTier: number;
21
- priority: MasterCSSRulePriorityIR;
22
- text: string;
23
- nodes?: MasterCSSGeneratedRuleNodeIR[];
24
- selectorText?: string;
25
- variableNames?: string[];
26
- animationNames?: string[];
30
+ interface MasterCSSHydrationRuleNode {
31
+ readonly text: string;
32
+ }
33
+ interface MasterCSSHydrationRule {
34
+ readonly className: string;
35
+ readonly key: string;
36
+ readonly layer: MasterCSSManifestUtilityLayerName;
37
+ readonly type: UtilityType;
38
+ readonly sortTier: number;
39
+ readonly priority: MasterCSSRulePriority;
40
+ readonly text: string;
41
+ readonly nodes?: readonly MasterCSSHydrationRuleNode[];
42
+ readonly selectorText?: string;
43
+ readonly variableNames?: readonly string[];
44
+ readonly keyframeNames?: readonly string[];
45
+ readonly retainAllKeyframes?: boolean;
27
46
  }
28
47
  interface MasterCSSHydrationManifest {
29
- version: 1;
30
- rules: MasterCSSGeneratedRuleIR[];
48
+ readonly version: 5;
49
+ readonly languageVersion: 18;
50
+ /**
51
+ * Every rendered class: those with rules in rule order, then those without, such as
52
+ * authored component classes, then classes manifest selectors reference without rules
53
+ * of their own, such as mode classes. The runtime treats them as covered by the
54
+ * pre-rendered CSS and replays them to verify it when the engine starts.
55
+ */
56
+ readonly classNames: readonly string[];
57
+ readonly resourceOrder: {
58
+ readonly variables: readonly string[];
59
+ readonly keyframes: readonly string[];
60
+ };
61
+ /** Resource counts the server render treated as emitted by the page's stylesheets. */
62
+ readonly emittedGlobals?: MasterCSSEmittedGlobals;
31
63
  }
32
64
  declare function serializeMasterCSSHydrationManifest(hydrationManifest: MasterCSSHydrationManifest): string;
33
65
  declare function createMasterCSSHydrationManifestScript(hydrationManifest: MasterCSSHydrationManifest): string;
34
- //#endregion
35
- export { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, MasterCSSGeneratedRuleIR, MasterCSSGeneratedRuleNodeIR, MasterCSSHydrationManifest, MasterCSSRulePriorityIR, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest };
66
+ export { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, MasterCSSConditionRange, MasterCSSHydrationManifest, MasterCSSHydrationRule, MasterCSSHydrationRuleNode, MasterCSSRulePriority, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest };
@@ -1,4 +1,4 @@
1
- //#region src/hydration-manifest.ts
1
+ // src/hydration-manifest.ts
2
2
  const MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID = "master-css-hydration-manifest";
3
3
  const MASTER_CSS_HYDRATION_MANIFEST_ATTR = "data-master-css-hydration-manifest";
4
4
  const MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE = "/_master-css/hydration/";
@@ -9,5 +9,4 @@ function serializeMasterCSSHydrationManifest(hydrationManifest) {
9
9
  function createMasterCSSHydrationManifestScript(hydrationManifest) {
10
10
  return `<script type="application/json" id="${MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID}">${serializeMasterCSSHydrationManifest(hydrationManifest)}<\/script>`;
11
11
  }
12
- //#endregion
13
12
  export { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- export * from "./manifest.js";
2
- export * from "./manifest-json.js";
3
- export * from "./hydration-manifest.js";
4
- export * from "./css-directives.js";
5
- export * from "./css-syntax.js";
6
- export * from "./utility-type.js";
7
- export * from "./runtime-style.js";
8
- export * from "./native-css-shorthand.js";
9
- export * from "./css-common.js";
1
+ import { MasterCSSManifest, flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables, normalizeMasterCSSManifest, serializeMasterCSSManifest } from "./manifest.js";
2
+ import { MASTER_CSS_DIAGNOSTIC_VERSION, MasterCSSDiagnostic, MasterCSSDiagnosticDomain, MasterCSSDiagnosticPosition, MasterCSSDiagnosticRange, MasterCSSDiagnosticSeverity, MasterCSSError, MasterCSSErrorOptions, MasterCSSErrorPayload } from "./diagnostics.js";
3
+ import { MASTER_CSS_RENDERING_MODES, MasterCSSIntegrationOptions, MasterCSSIntegrationRuntimeOptions, MasterCSSRenderingMode, isMasterCSSRenderingMode } from "./integration.js";
4
+ export { MASTER_CSS_DIAGNOSTIC_VERSION, MASTER_CSS_RENDERING_MODES, type MasterCSSDiagnostic, type MasterCSSDiagnosticDomain, type MasterCSSDiagnosticPosition, type MasterCSSDiagnosticRange, type MasterCSSDiagnosticSeverity, MasterCSSError, type MasterCSSErrorOptions, type MasterCSSErrorPayload, type MasterCSSIntegrationOptions, type MasterCSSIntegrationRuntimeOptions, type MasterCSSManifest, type MasterCSSRenderingMode, flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables, isMasterCSSRenderingMode, normalizeMasterCSSManifest, serializeMasterCSSManifest };
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
- import { CSSDirectiveError, createCSSDirectiveSourceReference } from "./css-directives.js";
2
- import { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest } from "./hydration-manifest.js";
1
+ import { MASTER_CSS_DIAGNOSTIC_VERSION, MasterCSSError } from "./diagnostics.js";
2
+ import { normalizeMasterCSSManifest, serializeMasterCSSManifest } from "./manifest-json.js";
3
3
  import { flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables } from "./manifest.js";
4
- import { normalizeMasterCSSManifestForJSON, stringifyMasterCSSManifestJSON } from "./manifest-json.js";
5
- import { UtilityType } from "./utility-type.js";
6
- import { MASTER_CSS_RUNTIME_STYLE_ID } from "./runtime-style.js";
7
- import { isNativeCSSShorthandProperty } from "./native-css-shorthand.js";
8
- export { CSSDirectiveError, MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, MASTER_CSS_RUNTIME_STYLE_ID, UtilityType, createCSSDirectiveSourceReference, createMasterCSSHydrationManifestScript, flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables, isNativeCSSShorthandProperty, normalizeMasterCSSManifestForJSON, serializeMasterCSSHydrationManifest, stringifyMasterCSSManifestJSON };
4
+ import { MASTER_CSS_RENDERING_MODES, isMasterCSSRenderingMode } from "./integration.js";
5
+ export { MASTER_CSS_DIAGNOSTIC_VERSION, MASTER_CSS_RENDERING_MODES, MasterCSSError, flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables, isMasterCSSRenderingMode, normalizeMasterCSSManifest, serializeMasterCSSManifest };
@@ -0,0 +1,14 @@
1
+ declare const MASTER_CSS_RENDERING_MODES: readonly ['runtime', 'static', 'prerender', 'progressive'];
2
+ type MasterCSSRenderingMode = typeof MASTER_CSS_RENDERING_MODES[number];
3
+ interface MasterCSSIntegrationRuntimeOptions {
4
+ enabled?: boolean;
5
+ avoidFOUC?: boolean;
6
+ }
7
+ interface MasterCSSIntegrationOptions {
8
+ enabled?: boolean;
9
+ mode?: MasterCSSRenderingMode;
10
+ pruneNativeCSS?: boolean;
11
+ runtime?: boolean | MasterCSSIntegrationRuntimeOptions;
12
+ }
13
+ declare function isMasterCSSRenderingMode(value: unknown): value is MasterCSSRenderingMode;
14
+ export { MASTER_CSS_RENDERING_MODES, MasterCSSIntegrationOptions, MasterCSSIntegrationRuntimeOptions, MasterCSSRenderingMode, isMasterCSSRenderingMode };
@@ -0,0 +1,11 @@
1
+ // src/integration.ts
2
+ const MASTER_CSS_RENDERING_MODES = [
3
+ "runtime",
4
+ "static",
5
+ "prerender",
6
+ "progressive"
7
+ ];
8
+ function isMasterCSSRenderingMode(value) {
9
+ return MASTER_CSS_RENDERING_MODES.includes(value);
10
+ }
11
+ export { MASTER_CSS_RENDERING_MODES, isMasterCSSRenderingMode };
@@ -0,0 +1,24 @@
1
+ import { CSSDirectiveSourceReference } from "./css-directives.js";
2
+ /**
3
+ * A native `@keyframes` rule of Master-compiled CSS. A `native` definition is
4
+ * delivered in place by its stylesheet or the host, and engines never emit it.
5
+ * Every other definition comes from a `@prune native` stylesheet and is emitted on
6
+ * demand, like a token, by the engine whose output references it.
7
+ */
8
+ interface MasterCSSKeyframeDefinition {
9
+ id: string;
10
+ name: string;
11
+ text: string;
12
+ /** The enclosing conditional and layer rules an emitted definition is wrapped in. */
13
+ containers?: MasterCSSKeyframeContainer[];
14
+ native?: boolean;
15
+ /** `@safelist keyframes` emits the definition without a reference. */
16
+ safelisted?: boolean;
17
+ dependencies?: string[];
18
+ source?: CSSDirectiveSourceReference;
19
+ }
20
+ interface MasterCSSKeyframeContainer {
21
+ id: string;
22
+ prelude: string;
23
+ }
24
+ export { MasterCSSKeyframeContainer, MasterCSSKeyframeDefinition };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,4 @@
1
1
  import { MasterCSSManifest } from "./manifest.js";
2
- //#region src/manifest-json.d.ts
3
- declare function normalizeMasterCSSManifestForJSON(manifest: MasterCSSManifest): MasterCSSManifest;
4
- declare function stringifyMasterCSSManifestJSON(manifest: MasterCSSManifest): string;
5
- //#endregion
6
- export { normalizeMasterCSSManifestForJSON, stringifyMasterCSSManifestJSON };
2
+ declare function normalizeMasterCSSManifest(manifest: MasterCSSManifest): MasterCSSManifest;
3
+ declare function serializeMasterCSSManifest(manifest: MasterCSSManifest): string;
4
+ export { normalizeMasterCSSManifest, serializeMasterCSSManifest };
@@ -1,15 +1,7 @@
1
- //#region src/manifest-json.ts
1
+ // src/manifest-json.ts
2
2
  function getVariableName(namespace, variable) {
3
3
  return variable.name || (namespace ? `${namespace}${variable.key ? "-" + variable.key : ""}` : variable.key);
4
4
  }
5
- function normalizeTemplateDeclarations(declarations) {
6
- const normalized = {};
7
- for (const propertyName in declarations) {
8
- const value = declarations[propertyName];
9
- normalized[propertyName] = Array.isArray(value) ? value.map((part) => part === void 0 ? null : part) : value === void 0 ? null : value;
10
- }
11
- return normalized;
12
- }
13
5
  function normalizeVariablesForJSON(variables) {
14
6
  if (!variables) return;
15
7
  const normalized = {};
@@ -25,29 +17,13 @@ function normalizeVariablesForJSON(variables) {
25
17
  }
26
18
  return Object.keys(normalized).length ? normalized : void 0;
27
19
  }
28
- function normalizeUtilityForJSON(utility) {
29
- const normalized = { ...utility };
30
- if (normalized.name === normalized.id) delete normalized.name;
31
- if (normalized.layer === "utilities") delete normalized.layer;
32
- delete normalized.order;
33
- if (normalized.emit.type !== "template") return normalized;
34
- return {
35
- ...normalized,
36
- emit: {
37
- ...normalized.emit,
38
- declarations: normalizeTemplateDeclarations(normalized.emit.declarations)
39
- }
40
- };
41
- }
42
- function normalizeMasterCSSManifestForJSON(manifest) {
20
+ function normalizeMasterCSSManifest(manifest) {
43
21
  return {
44
22
  ...manifest,
45
- ...manifest.variables ? { variables: normalizeVariablesForJSON(manifest.variables) } : {},
46
- ...manifest.utilities?.length ? { utilities: manifest.utilities.map(normalizeUtilityForJSON) } : {}
23
+ ...manifest.variables ? { variables: normalizeVariablesForJSON(manifest.variables) } : {}
47
24
  };
48
25
  }
49
- function stringifyMasterCSSManifestJSON(manifest) {
50
- return JSON.stringify(normalizeMasterCSSManifestForJSON(manifest));
26
+ function serializeMasterCSSManifest(manifest) {
27
+ return JSON.stringify(normalizeMasterCSSManifest(manifest));
51
28
  }
52
- //#endregion
53
- export { normalizeMasterCSSManifestForJSON, stringifyMasterCSSManifestJSON };
29
+ export { normalizeMasterCSSManifest, serializeMasterCSSManifest };