@master/css-runtime 2.0.0-rc.73 → 2.0.0-rc.74

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Aoyue Design LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -1,12 +1,14 @@
1
+ //#region src/class-tracker.d.ts
1
2
  type ClassDeltaMap = Map<string, number>;
2
3
  type ClassCountMap = Map<string, number>;
3
- export default class RuntimeClassTracker {
4
- private snapshots;
5
- reset(): void;
6
- collectConnected(root: Document | ShadowRoot, classCounts: ClassCountMap): Set<string>;
7
- collectMutations(records: MutationRecord[]): ClassDeltaMap;
8
- private snapshotElement;
9
- private diffElement;
10
- private removeElement;
4
+ declare class RuntimeClassTracker {
5
+ private snapshots;
6
+ reset(): void;
7
+ collectConnected(root: Document | ShadowRoot, classCounts: ClassCountMap): Set<string>;
8
+ collectMutations(records: MutationRecord[]): ClassDeltaMap;
9
+ private snapshotElement;
10
+ private diffElement;
11
+ private removeElement;
11
12
  }
12
- export {};
13
+ //#endregion
14
+ export { RuntimeClassTracker as default };
package/dist/core.d.ts CHANGED
@@ -1,71 +1,86 @@
1
- import { MasterCSS } from '@master/css-engine';
2
- import type { MasterCSSManifest } from '@master/css-schema/manifest';
3
- import type { MasterCSSEmittedGlobals } from '@master/css-engine';
4
- import { type MasterCSSHydrationManifest } from '@master/css-schema/hydration-manifest';
5
- import { HydrateResult } from './types';
6
- import RuntimeUtilityLayer from './utility-layer';
7
- import RuntimeThemeLayer from './theme-layer';
8
- export interface CSSRuntimeCreateOptions {
9
- manifest: MasterCSSManifest;
10
- root?: Document | ShadowRoot;
11
- emittedGlobals?: MasterCSSEmittedGlobals;
12
- hydrationManifest?: MasterCSSHydrationManifest;
1
+ import RuntimeUtilityLayer from "./utility-layer.js";
2
+ import { HydrateResult } from "./types/hydrate-result.js";
3
+ import RuntimeThemeLayer from "./theme-layer.js";
4
+ import { MasterCSS, MasterCSSEmittedGlobals } from "@master/css-engine";
5
+ import { MasterCSSManifest } from "@master/css-schema/manifest";
6
+ import { MasterCSSHydrationManifest } from "@master/css-schema/hydration-manifest";
7
+
8
+ //#region src/core.d.ts
9
+ interface CSSRuntimeCreateOptions {
10
+ manifest: MasterCSSManifest;
11
+ root?: Document | ShadowRoot;
12
+ emittedGlobals?: MasterCSSEmittedGlobals;
13
+ hydrationManifest?: MasterCSSHydrationManifest;
13
14
  }
14
- export default class CSSRuntime extends MasterCSS {
15
- root: Document | ShadowRoot;
16
- hydrationManifest?: MasterCSSHydrationManifest | undefined;
17
- static instances: WeakMap<Document | ShadowRoot, CSSRuntime>;
18
- readonly host: Element;
19
- readonly container: HTMLElement | ShadowRoot;
20
- readonly baseLayer: RuntimeUtilityLayer;
21
- readonly themeLayer: RuntimeThemeLayer;
22
- readonly defaultsLayer: RuntimeUtilityLayer;
23
- readonly componentsLayer: RuntimeUtilityLayer;
24
- readonly utilitiesLayer: RuntimeUtilityLayer;
25
- readonly classCounts: Map<string, number>;
26
- private readonly classTracker;
27
- private hydrationFailureReason?;
28
- observer?: MutationObserver;
29
- progressive: boolean;
30
- observing: boolean;
31
- static create(options: CSSRuntimeCreateOptions): CSSRuntime;
32
- constructor(root: (Document | ShadowRoot) | undefined, manifest: MasterCSSManifest, emittedGlobals?: MasterCSSEmittedGlobals, hydrationManifest?: MasterCSSHydrationManifest | undefined);
33
- register(): this;
34
- unregister(): this;
35
- setHydrationManifest(hydrationManifest?: MasterCSSHydrationManifest): this;
36
- needsHydrationManifest(): boolean;
37
- loadHydrationManifest(): Promise<this>;
38
- private createRuntimeStyle;
39
- private warnHydrationFallback;
40
- private useRuntimeStyle;
41
- private detectRuntimeStyle;
42
- private collectConnectedClasses;
43
- private hydrateRuntimeStyle;
44
- private renderRuntimeStyle;
45
- private handleMutationRecords;
46
- private startMutationObserver;
47
- private revealHostIfNeeded;
48
- /**
49
- * Observe the DOM for changes and update the running stylesheet. (browser only)
50
- * @param options mutation observer options
51
- * @returns this
52
- */
53
- observe(): this;
54
- private failHydration;
55
- private getHydrationManifestLayerRules;
56
- private registerHydratedClassRule;
57
- private getUtilityLayerByName;
58
- private collectHydrationManifestVariableNames;
59
- private collectHydrationManifestAnimationNames;
60
- private nativeThemeLayerHasOnlyEmittedGlobalsVariables;
61
- private getVariableRuleBuckets;
62
- private isSyntheticColorSchemeDeclaration;
63
- private getNativeThemeRuleBucketKey;
64
- private hydrateHydrationManifestVariables;
65
- private hydrateHydrationManifestAnimations;
66
- private hydrateHydrationManifestLayer;
67
- hydrate(nativeLayerRules: CSSRuleList): HydrateResult | undefined;
68
- disconnect(): this | undefined;
69
- refresh(manifest?: MasterCSSManifest): this;
70
- destroy(): this;
15
+ declare class CSSRuntime extends MasterCSS {
16
+ root: Document | ShadowRoot;
17
+ hydrationManifest?: MasterCSSHydrationManifest | undefined;
18
+ static instances: WeakMap<Document | ShadowRoot, CSSRuntime>;
19
+ readonly host: Element;
20
+ readonly container: HTMLElement | ShadowRoot;
21
+ readonly baseLayer: RuntimeUtilityLayer;
22
+ readonly themeLayer: RuntimeThemeLayer;
23
+ readonly defaultsLayer: RuntimeUtilityLayer;
24
+ readonly componentsLayer: RuntimeUtilityLayer;
25
+ readonly utilitiesLayer: RuntimeUtilityLayer;
26
+ readonly classCounts: Map<string, number>;
27
+ private readonly classTracker;
28
+ private readonly pendingRemovedClassNames;
29
+ private pendingRemovalFrame;
30
+ private pendingRemovalFlushFrame;
31
+ private hydrationFailureReason?;
32
+ observer?: MutationObserver;
33
+ progressive: boolean;
34
+ observing: boolean;
35
+ static create(options: CSSRuntimeCreateOptions): CSSRuntime;
36
+ constructor(root: (Document | ShadowRoot) | undefined, manifest: MasterCSSManifest, emittedGlobals?: MasterCSSEmittedGlobals, hydrationManifest?: MasterCSSHydrationManifest | undefined);
37
+ register(): this;
38
+ unregister(): this;
39
+ setHydrationManifest(hydrationManifest?: MasterCSSHydrationManifest): this;
40
+ needsHydrationManifest(): boolean;
41
+ loadHydrationManifest(): Promise<this>;
42
+ private createRuntimeStyle;
43
+ private warnHydrationFallback;
44
+ private useRuntimeStyle;
45
+ private detectRuntimeStyle;
46
+ private collectConnectedClasses;
47
+ private hydrateRuntimeStyle;
48
+ private renderRuntimeStyle;
49
+ private getAnimationFrameWindow;
50
+ private cancelPendingRemovalFrames;
51
+ private clearPendingRemovedClassNames;
52
+ private cancelPendingRemovedClassNames;
53
+ private schedulePendingRemovalFlush;
54
+ private queueRemovedClassNames;
55
+ private flushPendingRemovedClassNames;
56
+ private handleMutationRecords;
57
+ add(...classNames: string[]): this;
58
+ remove(...classNames: string[]): void;
59
+ private startMutationObserver;
60
+ private revealHostIfNeeded;
61
+ /**
62
+ * Observe the DOM for changes and update the running stylesheet. (browser only)
63
+ * @param options mutation observer options
64
+ * @returns this
65
+ */
66
+ observe(): this;
67
+ private failHydration;
68
+ private getHydrationManifestLayerRules;
69
+ private registerHydratedClassRule;
70
+ private getUtilityLayerByName;
71
+ private collectHydrationManifestVariableNames;
72
+ private collectHydrationManifestAnimationNames;
73
+ private nativeThemeLayerHasOnlyEmittedGlobalsVariables;
74
+ private getVariableRuleBuckets;
75
+ private isSyntheticColorSchemeDeclaration;
76
+ private getNativeThemeRuleBucketKey;
77
+ private hydrateHydrationManifestVariables;
78
+ private hydrateHydrationManifestAnimations;
79
+ private hydrateHydrationManifestLayer;
80
+ hydrate(nativeLayerRules: CSSRuleList): HydrateResult | undefined;
81
+ disconnect(): this | undefined;
82
+ refresh(manifest?: MasterCSSManifest): this;
83
+ destroy(): this;
71
84
  }
85
+ //#endregion
86
+ export { CSSRuntimeCreateOptions, CSSRuntime as default };
@@ -1,17 +1,20 @@
1
- import type { MasterCSSManifest } from '@master/css-schema/manifest';
2
- import type { MasterCSSEmittedGlobals } from '@master/css-engine';
3
- import type { MasterCSSHydrationManifest } from '@master/css-schema/hydration-manifest';
1
+ import { MasterCSSEmittedGlobals } from "@master/css-engine";
2
+ import { MasterCSSManifest } from "@master/css-schema/manifest";
3
+ import { MasterCSSHydrationManifest } from "@master/css-schema/hydration-manifest";
4
+
5
+ //#region src/css-runtime.d.ts
4
6
  type CSSRuntimeHostConstructor = new (...args: any[]) => HTMLElement;
5
7
  type CSSRuntimeManifest = MasterCSSManifest | ((host: HTMLElement) => MasterCSSManifest);
6
8
  type CSSRuntimeRoot = ShadowRoot | ((host: HTMLElement) => ShadowRoot | null | undefined);
7
9
  type CSSRuntimeEmittedGlobals = MasterCSSEmittedGlobals | ((host: HTMLElement) => MasterCSSEmittedGlobals | undefined);
8
10
  type CSSHydrationManifest = MasterCSSHydrationManifest | ((host: HTMLElement) => MasterCSSHydrationManifest | undefined);
9
- export interface CSSRuntimeOptions {
10
- manifest: CSSRuntimeManifest;
11
- root?: CSSRuntimeRoot;
12
- emittedGlobals?: CSSRuntimeEmittedGlobals;
13
- hydrationManifest?: CSSHydrationManifest;
11
+ interface CSSRuntimeOptions {
12
+ manifest: CSSRuntimeManifest;
13
+ root?: CSSRuntimeRoot;
14
+ emittedGlobals?: CSSRuntimeEmittedGlobals;
15
+ hydrationManifest?: CSSHydrationManifest;
14
16
  }
15
- export type CSSRuntimeDecoratorOptions = CSSRuntimeOptions;
16
- export default function cssRuntime(options: CSSRuntimeOptions): <T extends CSSRuntimeHostConstructor>(target: T) => T;
17
- export {};
17
+ type CSSRuntimeDecoratorOptions = CSSRuntimeOptions;
18
+ declare function cssRuntime(options: CSSRuntimeOptions): <T extends CSSRuntimeHostConstructor>(target: T) => T;
19
+ //#endregion
20
+ export { CSSRuntimeDecoratorOptions, CSSRuntimeOptions, cssRuntime as default };
@@ -1,2 +1,6 @@
1
- import type CSSRuntime from '../core';
2
- export default function debugRuntimeMutation(records: MutationRecord[], classCounts: Map<string, number>, cssRuntime: CSSRuntime): void;
1
+ import CSSRuntime from "../core.js";
2
+
3
+ //#region src/debuggers/class-count.d.ts
4
+ declare function debugRuntimeMutation(records: MutationRecord[], classCounts: Map<string, number>, cssRuntime: CSSRuntime): void;
5
+ //#endregion
6
+ export { debugRuntimeMutation as default };
@@ -1,3 +1,7 @@
1
- export { default as debugRuntimeMutation } from './class-count';
2
- export { debugRuntimeCreated, debugRuntimeDestroyed, debugRuntimeDisconnected, debugRuntimeHydrated, debugRuntimeObserved, debugRuntimeRefreshed } from './lifecycle';
3
- export default function startDebuggers(): void;
1
+ import debugRuntimeMutation from "./class-count.js";
2
+ import { debugRuntimeCreated, debugRuntimeDestroyed, debugRuntimeDisconnected, debugRuntimeHydrated, debugRuntimeObserved, debugRuntimeRefreshed } from "./lifecycle.js";
3
+
4
+ //#region src/debuggers/index.d.ts
5
+ declare function startDebuggers(): void;
6
+ //#endregion
7
+ export { debugRuntimeCreated, debugRuntimeDestroyed, debugRuntimeDisconnected, debugRuntimeHydrated, debugRuntimeMutation, debugRuntimeObserved, debugRuntimeRefreshed, startDebuggers as default };
@@ -1,9 +1,13 @@
1
- import type CSSRuntime from '../core';
2
- import type { MasterCSSManifest } from '@master/css-schema/manifest';
3
- import type { HydrateResult } from '../types';
4
- export declare function debugRuntimeCreated(cssRuntime: CSSRuntime): void;
5
- export declare function debugRuntimeHydrated(cssRuntime: CSSRuntime, result: HydrateResult): void;
6
- export declare function debugRuntimeObserved(cssRuntime: CSSRuntime): void;
7
- export declare function debugRuntimeRefreshed(cssRuntime: CSSRuntime, manifest: MasterCSSManifest): void;
8
- export declare function debugRuntimeDisconnected(cssRuntime: CSSRuntime): void;
9
- export declare function debugRuntimeDestroyed(cssRuntime: CSSRuntime): void;
1
+ import { HydrateResult } from "../types/hydrate-result.js";
2
+ import CSSRuntime from "../core.js";
3
+ import { MasterCSSManifest } from "@master/css-schema/manifest";
4
+
5
+ //#region src/debuggers/lifecycle.d.ts
6
+ declare function debugRuntimeCreated(cssRuntime: CSSRuntime): void;
7
+ declare function debugRuntimeHydrated(cssRuntime: CSSRuntime, result: HydrateResult): void;
8
+ declare function debugRuntimeObserved(cssRuntime: CSSRuntime): void;
9
+ declare function debugRuntimeRefreshed(cssRuntime: CSSRuntime, manifest: MasterCSSManifest): void;
10
+ declare function debugRuntimeDisconnected(cssRuntime: CSSRuntime): void;
11
+ declare function debugRuntimeDestroyed(cssRuntime: CSSRuntime): void;
12
+ //#endregion
13
+ export { debugRuntimeCreated, debugRuntimeDestroyed, debugRuntimeDisconnected, debugRuntimeHydrated, debugRuntimeObserved, debugRuntimeRefreshed };
@@ -1,17 +1,19 @@
1
+ //#region src/debuggers/log.d.ts
1
2
  type ConsoleMethod = 'log' | 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'table' | 'group' | 'groupCollapsed' | 'groupEnd' | 'time' | 'timeEnd';
2
3
  declare const createLogger: (type?: Exclude<ConsoleMethod, "table" | "group" | "groupCollapsed" | "groupEnd" | "time" | "timeEnd">) => (message: string, ...args: unknown[]) => void;
3
4
  declare const loggers: {
4
- info: (message: string, ...args: unknown[]) => void;
5
- debug: (message: string, ...args: unknown[]) => void;
6
- warn: (...data: any[]) => void;
7
- error: (...data: any[]) => void;
8
- trace: (...data: any[]) => void;
9
- table: (tabularData?: any, properties?: string[]) => void;
10
- group: (...data: any[]) => void;
11
- groupCollapsed: (...data: any[]) => void;
12
- groupEnd: () => void;
13
- time: (label?: string) => void;
14
- timeEnd: (label?: string) => void;
5
+ info: (message: string, ...args: unknown[]) => void;
6
+ debug: (message: string, ...args: unknown[]) => void;
7
+ warn: (...data: any[]) => void;
8
+ error: (...data: any[]) => void;
9
+ trace: (...data: any[]) => void;
10
+ table: (tabularData?: any, properties?: string[]) => void;
11
+ group: (...data: any[]) => void;
12
+ groupCollapsed: (...data: any[]) => void;
13
+ groupEnd: () => void;
14
+ time: (label?: string) => void;
15
+ timeEnd: (label?: string) => void;
15
16
  };
16
17
  declare const log: ReturnType<typeof createLogger> & typeof loggers;
17
- export default log;
18
+ //#endregion
19
+ export { log as default };