@mirage-engine/core 0.2.2 → 0.3.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.
@@ -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;
@@ -27,6 +27,10 @@ export interface SceneNode {
27
27
 
28
28
  visibility: Visibility;
29
29
  isTraveler: boolean;
30
+ captureLayer: number;
31
+ nativeLayer?: number;
32
+ nativeStyles?: BoxStyles | TextStyles;
33
+ nativeRect?: NodeRect;
30
34
  isFixed: boolean;
31
35
  shaderHooks?: ShaderHooks;
32
36
 
@@ -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? : travelerClipArea;
23
+ travelerClipArea?: travelerClipArea;
29
24
  }
30
25
 
31
26
  export interface OverlayConfig extends BaseConfig {
@@ -1,22 +1,27 @@
1
- //Bitmask Flags
2
- export const DIRTY_NONE = 0;
3
- export const DIRTY_RECT = 1 << 0; // 1: x, y, width, height (00000001)
4
- export const DIRTY_STYLE = 1 << 1; // 2: style (00000010)
5
- export const DIRTY_ZINDEX = 1 << 2; // 4: zIndex (00000100)
6
- export const DIRTY_STRUCTURE = 1 << 3; // 8: childNode add / delete (00001000)
7
- export const DIRTY_CONTENT = 1 << 4; // 16: text content changed (00010000)
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 SYSTEM_LAYER = 1 << 1;
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);
@@ -1,4 +1,5 @@
1
1
  export * from './config';
2
2
  export * from './common';
3
+ export * from './attributes';
3
4
  export * from './flags';
4
- export * from './animate';
5
+ export * from '@mirage-engine/dom-tracker';