@player-ui/check-path-plugin 0.3.0-next.3 → 0.3.0-next.5

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/dist/index.cjs.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var view = require('@player-ui/view');
5
+ var player = require('@player-ui/player');
6
6
  var partialMatchRegistry = require('@player-ui/partial-match-registry');
7
7
  var dlv = require('dlv');
8
8
 
@@ -22,11 +22,11 @@ function createMatcher(match) {
22
22
  function getParent(node, viewInfo) {
23
23
  var _a;
24
24
  let working = node;
25
- while (working.parent && working.parent.type !== view.NodeType.Asset && working.parent.type !== view.NodeType.View) {
25
+ while (working.parent && working.parent.type !== player.NodeType.Asset && working.parent.type !== player.NodeType.View) {
26
26
  working = working.parent;
27
27
  }
28
28
  const { parent } = working;
29
- if (parent && (parent.type === view.NodeType.Asset || parent.type === view.NodeType.View)) {
29
+ if (parent && (parent.type === player.NodeType.Asset || parent.type === player.NodeType.View)) {
30
30
  return (_a = viewInfo.resolver.getSourceNode(parent)) != null ? _a : parent;
31
31
  }
32
32
  }
@@ -34,10 +34,10 @@ class CheckPathPlugin {
34
34
  constructor() {
35
35
  this.name = "check-path";
36
36
  }
37
- apply(player) {
38
- player.hooks.viewController.tap(this.name, (viewController) => {
39
- viewController.hooks.view.tap(this.name, (view$1) => {
40
- view$1.hooks.resolver.tap(this.name, (resolver) => {
37
+ apply(player$1) {
38
+ player$1.hooks.viewController.tap(this.name, (viewController) => {
39
+ viewController.hooks.view.tap(this.name, (view) => {
40
+ view.hooks.resolver.tap(this.name, (resolver) => {
41
41
  const viewInfo = {
42
42
  resolvedMap: new Map(),
43
43
  assetIdMap: new Map(),
@@ -51,7 +51,7 @@ class CheckPathPlugin {
51
51
  resolved: node,
52
52
  value
53
53
  });
54
- if (node.type === view.NodeType.Asset || node.type === view.NodeType.View) {
54
+ if (node.type === player.NodeType.Asset || node.type === player.NodeType.View) {
55
55
  const id = dlv__default["default"](value, "id");
56
56
  if (id) {
57
57
  viewInfo.assetIdMap.set(id, node);
@@ -107,7 +107,7 @@ class CheckPathPlugin {
107
107
  let parent;
108
108
  while (working) {
109
109
  parent = (working == null ? void 0 : working.parent) && ((_b = this.viewInfo.resolvedMap.get(working.parent)) == null ? void 0 : _b.resolved);
110
- if (parent && (parent.type === view.NodeType.Asset || parent.type === view.NodeType.View)) {
110
+ if (parent && (parent.type === player.NodeType.Asset || parent.type === player.NodeType.View)) {
111
111
  break;
112
112
  }
113
113
  working = working == null ? void 0 : working.parent;
@@ -136,7 +136,7 @@ class CheckPathPlugin {
136
136
  }
137
137
  const [first, ...rest] = query;
138
138
  const matcher = createMatcher(first);
139
- if (node.type === view.NodeType.Asset || node.type === view.NodeType.View) {
139
+ if (node.type === player.NodeType.Asset || node.type === player.NodeType.View) {
140
140
  const resolved = (_a = this.viewInfo) == null ? void 0 : _a.resolvedMap.get(node);
141
141
  const includesSelf = (_b = includeSelfMatch && resolved && matcher(resolved.value)) != null ? _b : false;
142
142
  const childQuery = includesSelf ? rest : query;
@@ -149,7 +149,7 @@ class CheckPathPlugin {
149
149
  if ((_c = node.children) == null ? void 0 : _c.some((childNode) => this.findChildPath(childNode.value, childQuery))) {
150
150
  return true;
151
151
  }
152
- } else if (node.type === view.NodeType.MultiNode && node.values.some((childNode) => this.findChildPath(childNode, query))) {
152
+ } else if (node.type === player.NodeType.MultiNode && node.values.some((childNode) => this.findChildPath(childNode, query))) {
153
153
  return true;
154
154
  } else if ("children" in node && ((_d = node.children) == null ? void 0 : _d.some((childNode) => this.findChildPath(childNode.value, query)))) {
155
155
  return true;
@@ -196,7 +196,7 @@ class CheckPathPlugin {
196
196
  const parent = (working == null ? void 0 : working.parent) && this.viewInfo.resolvedMap.get(working.parent);
197
197
  const parentNode = parent == null ? void 0 : parent.resolved;
198
198
  if (parentNode) {
199
- if (parentNode.type === view.NodeType.MultiNode) {
199
+ if (parentNode.type === player.NodeType.MultiNode) {
200
200
  const index = parentNode.values.indexOf(working);
201
201
  if (index !== -1) {
202
202
  const actualIndex = index - parentNode.values.slice(0, index).reduce((undefCount, next) => {
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { NodeType } from '@player-ui/view';
1
+ import { NodeType } from '@player-ui/player';
2
2
  import { createObjectMatcher } from '@player-ui/partial-match-registry';
3
3
  import dlv from 'dlv';
4
4
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@player-ui/check-path-plugin",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0-next.5",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
7
7
  },
8
8
  "peerDependencies": {
9
- "@player-ui/player": "0.3.0-next.3"
9
+ "@player-ui/player": "0.3.0-next.5"
10
10
  },
11
11
  "dependencies": {
12
- "@player-ui/partial-match-registry": "0.3.0-next.3",
12
+ "@player-ui/partial-match-registry": "0.3.0-next.5",
13
13
  "dlv": "^1.1.3",
14
14
  "tapable-ts": "^0.1.0",
15
15
  "@babel/runtime": "7.15.4"
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
- import type { Player, PlayerPlugin } from '@player-ui/player';
2
- import type { Node, Resolver } from '@player-ui/view';
3
- import { NodeType } from '@player-ui/view';
1
+ import { NodeType } from '@player-ui/player';
2
+ import type { Player, PlayerPlugin, Node, Resolver } from '@player-ui/player';
4
3
  import type { Asset } from '@player-ui/types';
5
4
  import { createObjectMatcher } from '@player-ui/partial-match-registry';
6
5
  import dlv from 'dlv';