@master/css-runtime 2.0.0-rc.72 → 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 +21 -0
- package/dist/class-tracker.d.ts +11 -9
- package/dist/core.d.ts +84 -69
- package/dist/css-runtime.d.ts +14 -11
- package/dist/debuggers/class-count.d.ts +6 -2
- package/dist/debuggers/index.d.ts +7 -3
- package/dist/debuggers/lifecycle.d.ts +13 -9
- package/dist/debuggers/log.d.ts +14 -12
- package/dist/default-manifest.json +1 -1
- package/dist/generated-rule.d.ts +28 -24
- package/dist/global.min.d.ts +1 -1
- package/dist/global.min.js +3 -1
- package/dist/index.d.ts +8 -10
- package/dist/index.development.d.ts +6 -1
- package/dist/index.development.js +1211 -0
- package/dist/index.js +1211 -0
- package/dist/layer.d.ts +19 -15
- package/dist/native-declaration.d.ts +6 -2
- package/dist/register-global.d.ts +8 -4
- package/dist/theme-layer.d.ts +30 -27
- package/dist/types/hydrate-result.d.ts +8 -4
- package/dist/types/index.d.ts +2 -1
- package/dist/utility-layer.d.ts +14 -11
- package/dist/utils/find-native-css-rule-index.d.ts +4 -1
- package/package.json +71 -1
- package/dist/index.development.mjs +0 -1338
- package/dist/index.mjs +0 -1192
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.
|
package/dist/class-tracker.d.ts
CHANGED
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
export { RuntimeClassTracker as default };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,71 +1,86 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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 };
|
package/dist/css-runtime.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
interface CSSRuntimeOptions {
|
|
12
|
+
manifest: CSSRuntimeManifest;
|
|
13
|
+
root?: CSSRuntimeRoot;
|
|
14
|
+
emittedGlobals?: CSSRuntimeEmittedGlobals;
|
|
15
|
+
hydrationManifest?: CSSHydrationManifest;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
2
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 };
|
package/dist/debuggers/log.d.ts
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
export { log as default };
|