@mirage-engine/core 0.2.2 → 0.3.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/CHANGELOG.md +12 -0
- package/dist/mirage-engine.js +990 -639
- package/dist/mirage-engine.umd.js +16 -10
- package/dist/src/animation/Animator.d.ts +1 -6
- package/dist/src/core/Engine.d.ts +3 -0
- package/dist/src/core/Syncer.d.ts +2 -20
- package/dist/src/dom/Extractor.d.ts +1 -2
- package/dist/src/renderer/Renderer.d.ts +7 -5
- package/dist/src/types/attributes.d.ts +63 -0
- package/dist/src/types/common.d.ts +4 -0
- package/dist/src/types/config.d.ts +2 -8
- package/dist/src/types/flags.d.ts +8 -7
- package/dist/src/types/index.d.ts +2 -1
- package/package.json +3 -2
- package/src/animation/Animator.ts +2 -57
- package/src/core/Engine.ts +14 -2
- package/src/core/Syncer.ts +39 -235
- package/src/dom/Extractor.ts +357 -68
- package/src/renderer/Renderer.ts +283 -98
- package/src/store/TextureLifecycleManager.ts +24 -9
- package/src/types/attributes.ts +57 -0
- package/src/types/common.ts +4 -0
- package/src/types/config.ts +5 -10
- package/src/types/flags.ts +20 -15
- package/src/types/index.ts +2 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const filter_values = {
|
|
2
|
+
INCLUDE_TREE: "include-tree",
|
|
3
|
+
EXCLUDE_TREE: "exclude-tree",
|
|
4
|
+
INCLUDE_SELF: "include-self",
|
|
5
|
+
EXCLUDE_SELF: "exclude-self",
|
|
6
|
+
END: "end",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ATTR_DOM = {
|
|
10
|
+
NAME: "data-mirage-dom",
|
|
11
|
+
KEY: "mirageDom",
|
|
12
|
+
VALUES: {
|
|
13
|
+
HIDE: "hide",
|
|
14
|
+
},
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export const TRAVEL_VALUES = {
|
|
18
|
+
TRAVELER: "traveler",
|
|
19
|
+
NATIVE: "native",
|
|
20
|
+
CAPTURE_1: "1",
|
|
21
|
+
CAPTURE_2: "2",
|
|
22
|
+
CAPTURE_3: "3",
|
|
23
|
+
CAPTURE_4: "4",
|
|
24
|
+
CAPTURE_5: "5",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const ATTR_TRAVEL = {
|
|
28
|
+
NAME: "data-mirage-travel",
|
|
29
|
+
KEY: "mirageTravel",
|
|
30
|
+
VALUES: TRAVEL_VALUES,
|
|
31
|
+
MAX_LAYERS: Object.keys(TRAVEL_VALUES).length - 1,
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export const ATTR_FILTER = {
|
|
35
|
+
NAME: "data-mirage-filter",
|
|
36
|
+
KEY: "mirageFilter",
|
|
37
|
+
VALUES: filter_values,
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
export const ATTR_SELECT = {
|
|
41
|
+
NAME: "data-mirage-select",
|
|
42
|
+
KEY: "mirageSelect",
|
|
43
|
+
VALUES: filter_values,
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
export const ATTR_SHADER = {
|
|
47
|
+
NAME: "data-mirage-shader",
|
|
48
|
+
KEY: "mirageShader",
|
|
49
|
+
} as const;
|
|
50
|
+
|
|
51
|
+
export const ATTR_SANDWICH = {
|
|
52
|
+
NAME: "data-mirage-sandwich",
|
|
53
|
+
KEY: "mirageSandwich",
|
|
54
|
+
VALUES: {
|
|
55
|
+
FRONT: "front",
|
|
56
|
+
},
|
|
57
|
+
} as const;
|
package/src/types/common.ts
CHANGED
package/src/types/config.ts
CHANGED
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
export type Quality = "low" | "medium" | "high" | number;
|
|
2
|
+
export type LayerTarget = "base" | "selected"
|
|
2
3
|
export type MirageMode = "overlay" | "duplicate";
|
|
3
4
|
export type PxUnit = `${number}px`;
|
|
4
5
|
export type PercentUnit = `${number}%`;
|
|
5
6
|
export type travelerClipArea = PxUnit | PercentUnit | number;
|
|
6
|
-
export interface FilterConfig {
|
|
7
|
-
includeTree?: string[];
|
|
8
|
-
excludeTree?: string[];
|
|
9
|
-
includeSelf?: string[];
|
|
10
|
-
excludeSelf?: string[];
|
|
11
|
-
end?: string[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
7
|
export interface ResizeConfig {
|
|
15
8
|
delay?: number;
|
|
16
9
|
onStart?: () => void;
|
|
17
10
|
onEnd?: () => void;
|
|
18
11
|
}
|
|
19
12
|
|
|
13
|
+
|
|
14
|
+
|
|
20
15
|
interface BaseConfig {
|
|
21
16
|
debug?: boolean;
|
|
17
|
+
layer?: number | LayerTarget;
|
|
22
18
|
quality?: Quality;
|
|
23
19
|
style?: {
|
|
24
20
|
zIndex?: string;
|
|
25
21
|
};
|
|
26
|
-
filter?: FilterConfig;
|
|
27
22
|
resizeDebounce?: boolean | ResizeConfig;
|
|
28
|
-
travelerClipArea
|
|
23
|
+
travelerClipArea?: travelerClipArea;
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
export interface OverlayConfig extends BaseConfig {
|
package/src/types/flags.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ATTR_FILTER } from "./attributes";
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
DIRTY_NONE,
|
|
5
|
+
DIRTY_RECT,
|
|
6
|
+
DIRTY_STYLE,
|
|
7
|
+
DIRTY_ZINDEX,
|
|
8
|
+
DIRTY_STRUCTURE,
|
|
9
|
+
DIRTY_CONTENT,
|
|
10
|
+
} from "@mirage-engine/dom-tracker";
|
|
8
11
|
|
|
9
12
|
// Filtering Flag
|
|
10
13
|
export const USER_LAYER = 1 << 0;
|
|
11
|
-
export const
|
|
14
|
+
export const SELECT_LAYER = 1 << 1;
|
|
12
15
|
export const EXCLUDED = 0;
|
|
13
16
|
|
|
17
|
+
// Three.js Layer Channels (0 ~ 31)
|
|
18
|
+
export const THREE_LAYERS = {
|
|
19
|
+
BASE: 0,
|
|
20
|
+
SELECTED: 1,
|
|
21
|
+
getCaptureLayer: (layerNum: number) => 31 - layerNum,
|
|
22
|
+
HIDDEN: 31,
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
14
25
|
export type Visibility = 0 | 1 | 2 | 3;
|
|
15
26
|
|
|
16
|
-
export const ALLOWED_FILTERS =
|
|
17
|
-
"include-tree",
|
|
18
|
-
"exclude-tree",
|
|
19
|
-
"include-self",
|
|
20
|
-
"exclude-self",
|
|
21
|
-
"end",
|
|
22
|
-
];
|
|
27
|
+
export const ALLOWED_FILTERS = Object.values(ATTR_FILTER.VALUES);
|
package/src/types/index.ts
CHANGED