@nookuio/iframe 1.0.0 → 1.0.1-beta.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.
Files changed (50) hide show
  1. package/dist/constants.d.ts +9 -0
  2. package/dist/constants.js +11 -2
  3. package/dist/constants.mjs +9 -1
  4. package/dist/drag-drop/dragEnd.d.ts +2 -0
  5. package/dist/drag-drop/dragEnd.js +27 -0
  6. package/dist/drag-drop/dragEnd.mjs +23 -0
  7. package/dist/drag-drop/dragMove.d.ts +2 -0
  8. package/dist/drag-drop/dragMove.js +46 -0
  9. package/dist/drag-drop/dragMove.mjs +40 -0
  10. package/dist/drag-drop/dragReorder.d.ts +3 -0
  11. package/dist/drag-drop/dragReorder.js +60 -0
  12. package/dist/drag-drop/dragReorder.mjs +64 -0
  13. package/dist/drag-drop/dragStart.d.ts +9 -0
  14. package/dist/drag-drop/dragStart.js +60 -0
  15. package/dist/drag-drop/dragStart.mjs +55 -0
  16. package/dist/drag-drop/helpers.d.ts +42 -0
  17. package/dist/drag-drop/helpers.js +205 -0
  18. package/dist/drag-drop/helpers.mjs +188 -0
  19. package/dist/drag-drop/highlight.d.ts +16 -0
  20. package/dist/drag-drop/highlight.js +32 -0
  21. package/dist/drag-drop/highlight.mjs +22 -0
  22. package/dist/drag-drop/index.d.ts +24 -0
  23. package/dist/drag-drop/index.js +106 -0
  24. package/dist/drag-drop/index.mjs +83 -0
  25. package/dist/drag-drop/types.d.ts +123 -0
  26. package/dist/drag-drop/types.js +1 -0
  27. package/dist/drag-drop/types.mjs +0 -0
  28. package/dist/drag-drop backup/dragDropManager.d.ts +101 -0
  29. package/dist/drag-drop backup/dragDropManager.js +204 -0
  30. package/dist/drag-drop backup/dragDropManager.mjs +183 -0
  31. package/dist/drag-drop backup/index.d.ts +3 -0
  32. package/dist/drag-drop backup/index.js +38 -0
  33. package/dist/drag-drop backup/index.mjs +3 -0
  34. package/dist/drag-drop backup/types.d.ts +80 -0
  35. package/dist/drag-drop backup/types.js +1 -0
  36. package/dist/drag-drop backup/types.mjs +0 -0
  37. package/dist/drag-drop backup/utils.d.ts +41 -0
  38. package/dist/drag-drop backup/utils.js +93 -0
  39. package/dist/drag-drop backup/utils.mjs +68 -0
  40. package/dist/editor.d.ts +1 -7
  41. package/dist/editor.js +2 -2
  42. package/dist/editor.mjs +1 -1
  43. package/dist/iframe.d.ts +2 -8
  44. package/dist/iframe.js +46 -43
  45. package/dist/iframe.mjs +48 -46
  46. package/dist/types.d.ts +17 -3
  47. package/package.json +3 -2
  48. package/dist/createClient.d.ts +0 -51
  49. package/dist/createClient.js +0 -118
  50. package/dist/createClient.mjs +0 -114
package/dist/iframe.mjs CHANGED
@@ -1,78 +1,80 @@
1
- import { EDITOR_SOURCE_NAME as p, IFRAME_SOURCE_NAME as w } from "./constants.mjs";
2
- import { createClient as v } from "./createClient.mjs";
3
- import { stringify as C, parse as L } from "telejson";
4
- function b(u, d) {
1
+ import { EDITOR_SOURCE_NAME as b, IFRAME_SOURCE_NAME as w } from "./constants.mjs";
2
+ import { createClient as C } from "@nookuio/rpc";
3
+ import { stringify as v, parse as L } from "telejson";
4
+ import { createDragDropContext as x } from "./drag-drop/index.mjs";
5
+ function p(u, d) {
5
6
  return `[data-node-id="${d}"][data-node-path="${u}"]`;
6
7
  }
7
8
  function h(u, d) {
8
- const s = document.querySelectorAll(u);
9
- if (!s?.length) return;
10
- const l = Array.from(s).map((f) => {
11
- const c = f.getBoundingClientRect(), g = {
12
- width: c.width,
13
- height: c.height,
14
- top: c.top,
15
- left: c.left
9
+ const m = document.querySelectorAll(u);
10
+ if (!m?.length) return;
11
+ const r = Array.from(m).map((f) => {
12
+ const l = f.getBoundingClientRect(), g = {
13
+ width: l.width,
14
+ height: l.height,
15
+ top: l.top,
16
+ left: l.left
16
17
  };
17
18
  if (!d) return g;
18
- const m = window.getComputedStyle(f) ?? {};
19
+ const c = window.getComputedStyle(f) ?? {};
19
20
  return {
20
21
  ...g,
21
22
  padding: {
22
- top: m.paddingTop,
23
- right: m.paddingRight,
24
- bottom: m.paddingBottom,
25
- left: m.paddingLeft
23
+ top: c.paddingTop,
24
+ right: c.paddingRight,
25
+ bottom: c.paddingBottom,
26
+ left: c.paddingLeft
26
27
  }
27
28
  };
28
29
  });
29
- if (l?.length)
30
- return l.length === 1 ? l[0] : l;
30
+ if (r?.length)
31
+ return r.length === 1 ? r[0] : r;
31
32
  }
32
33
  export function createVueIframeClient(u, d) {
33
- const s = v(
34
+ const m = x(), r = C(
34
35
  {
35
36
  ...u,
37
+ ...m,
36
38
  async editText({ path: e, id: t }) {
37
39
  if (!e || t === void 0) return;
38
- const i = b(e, t), n = document.querySelector(i);
40
+ const i = p(e, t), n = document.querySelector(i);
39
41
  if (!n) return;
40
42
  n.style.outline = "none", n.setAttribute("spellcheck", "false"), n.setAttribute("contenteditable", "true");
41
43
  const o = (a) => {
42
44
  const E = a.target;
43
45
  if (!E) return;
44
46
  const y = E.innerText;
45
- n.removeAttribute("contenteditable"), s.emit("text-update", { path: e, id: t, content: y }), n.removeEventListener("blur", o), n.removeEventListener("keydown", r), n.blur();
46
- }, r = (a) => {
47
+ n.removeAttribute("contenteditable"), r.emit("text-update", { path: e, id: t, content: y }), n.removeEventListener("blur", o), n.removeEventListener("keydown", s), n.blur();
48
+ }, s = (a) => {
47
49
  a.key === "Enter" && (a.stopPropagation(), a.preventDefault(), o(a));
48
50
  };
49
- n.addEventListener("keydown", r), n.addEventListener("blur", o), n.focus();
51
+ n.addEventListener("keydown", s), n.addEventListener("blur", o), n.focus();
50
52
  },
51
53
  async getHoveredElement({ path: e, id: t, x: i, y: n }) {
52
54
  if (e)
53
55
  if (i !== void 0 && n !== void 0) {
54
56
  let o = document.elementFromPoint(i, n);
55
57
  if (!o) return;
56
- let r = o.getAttribute("data-node-path");
57
- if (r !== e) {
58
+ let s = o.getAttribute("data-node-path");
59
+ if (s !== e) {
58
60
  if (!o.parentElement) return;
59
- for (; o.parentElement && r !== e; )
60
- o = o.parentElement, r = o.getAttribute("data-node-path");
61
+ for (; o.parentElement && s !== e; )
62
+ o = o.parentElement, s = o.getAttribute("data-node-path");
61
63
  }
62
64
  const a = o.getAttribute("data-node-id");
63
65
  if (!a) return;
64
- const E = b(e, a), y = h(E, !1);
66
+ const E = p(e, a), y = h(E, !1);
65
67
  return y ? {
66
68
  id: a,
67
69
  path: e,
68
70
  data: y
69
71
  } : void 0;
70
72
  } else {
71
- const o = b(e, t), r = h(o, !1);
72
- return r ? {
73
+ const o = p(e, t), s = h(o, !1);
74
+ return s ? {
73
75
  id: t,
74
76
  path: e,
75
- data: r
77
+ data: s
76
78
  } : void 0;
77
79
  }
78
80
  },
@@ -80,7 +82,7 @@ export function createVueIframeClient(u, d) {
80
82
  return document.body.scrollHeight > 0 ? document.body.scrollHeight : document.documentElement.scrollHeight;
81
83
  },
82
84
  async getSelectedElement({ path: e, id: t }) {
83
- const i = b(e, t), n = h(i, !0);
85
+ const i = p(e, t), n = h(i, !0);
84
86
  if (n)
85
87
  return {
86
88
  path: e,
@@ -118,7 +120,7 @@ export function createVueIframeClient(u, d) {
118
120
  {
119
121
  handle(e) {
120
122
  window.addEventListener("message", async (t) => {
121
- if (typeof t.data != "object" || t.data.source !== p || t.data.type === "event" || !t.data.request) return;
123
+ if (typeof t.data != "object" || t.data.source !== b || t.data.type === "event" || !t.data.request) return;
122
124
  const i = await e(t.data.request);
123
125
  window.parent.postMessage({ source: w, response: i }, "*");
124
126
  });
@@ -128,8 +130,8 @@ export function createVueIframeClient(u, d) {
128
130
  const n = setTimeout(() => {
129
131
  window.removeEventListener("message", o), i(new Error("Request timed out"));
130
132
  }, 5e3);
131
- function o(r) {
132
- typeof r.data == "object" && (r.data.source !== p || !r.data.response || r.data.response.id === e.id && (clearTimeout(n), window.removeEventListener("message", o), t(r.data.response)));
133
+ function o(s) {
134
+ typeof s.data == "object" && (s.data.source !== b || !s.data.response || s.data.response.id === e.id && (clearTimeout(n), window.removeEventListener("message", o), t(s.data.response)));
133
135
  }
134
136
  window.parent.postMessage({ source: w, request: e }, "*"), window.addEventListener("message", o);
135
137
  });
@@ -139,23 +141,23 @@ export function createVueIframeClient(u, d) {
139
141
  },
140
142
  handleEvent(e) {
141
143
  window.addEventListener("message", (t) => {
142
- typeof t.data == "object" && (t.data.source !== p || t.data.type !== "event" || !t.data.request || e(t.data.request));
144
+ typeof t.data == "object" && (t.data.source !== b || t.data.type !== "event" || !t.data.request || e(t.data.request));
143
145
  });
144
146
  },
145
147
  deserialize: (e) => L(e),
146
- serialize: (e) => C(e, { maxDepth: 1 / 0 })
148
+ serialize: (e) => v(e, { maxDepth: 1 / 0 })
147
149
  }
148
- ), l = d?.disableDefaultConsole ? void 0 : console.log.bind(console), f = d?.disableDefaultConsole ? void 0 : console.warn.bind(console), c = d?.disableDefaultConsole ? void 0 : console.error.bind(console), g = d?.disableDefaultConsole ? void 0 : console.info.bind(console);
150
+ ), f = d?.disableDefaultConsole ? void 0 : console.log.bind(console), l = d?.disableDefaultConsole ? void 0 : console.warn.bind(console), g = d?.disableDefaultConsole ? void 0 : console.error.bind(console), c = d?.disableDefaultConsole ? void 0 : console.info.bind(console);
149
151
  return console.log = (...e) => {
150
- s.emit("console", "log", e), l?.(...e);
152
+ r.emit("console", "log", e), f?.(...e);
151
153
  }, console.warn = (...e) => {
152
- f?.(...e);
154
+ l?.(...e);
153
155
  }, console.error = (...e) => {
154
- s.emit("console", "error", e), c?.(...e);
156
+ r.emit("console", "error", e), g?.(...e);
155
157
  }, console.info = (...e) => {
156
- s.emit("console", "info", e), g?.(...e);
157
- }, window.addEventListener("resize", async () => s.emit("resize", await s.$context.getPageHeight())), new MutationObserver(
158
- async () => s.emit("resize", await s.$context.getPageHeight())
158
+ r.emit("console", "info", e), c?.(...e);
159
+ }, window.addEventListener("resize", async () => r.emit("resize", await r.$context.getPageHeight())), new MutationObserver(
160
+ async () => r.emit("resize", await r.$context.getPageHeight())
159
161
  ).observe(document.body, {
160
162
  childList: !0,
161
163
  // observe direct children additions/removals
@@ -165,5 +167,5 @@ export function createVueIframeClient(u, d) {
165
167
  // observe attribute changes (like style, class)
166
168
  characterData: !0
167
169
  // observe text changes
168
- }), s.emit("ready"), s;
170
+ }), r.emit("ready"), r;
169
171
  }
package/dist/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { RpcEvents } from '@nookuio/rpc';
2
+ import type { DragDropContext } from './drag-drop';
1
3
  export interface EventRequest {
2
4
  eventName: string;
3
5
  args: any[];
@@ -15,7 +17,7 @@ export interface ContextResponse {
15
17
  key: string;
16
18
  result: any;
17
19
  }
18
- export interface CoreIframeContext {
20
+ export interface CoreIframeContext extends DragDropContext {
19
21
  setTheme: (theme: 'dark' | 'light') => void;
20
22
  getHoveredElement: (options: {
21
23
  path: string;
@@ -41,7 +43,7 @@ export interface CoreIframeContext {
41
43
  id: string;
42
44
  }) => void;
43
45
  }
44
- export interface CoreIframeEvents {
46
+ export interface CoreIframeEvents extends RpcEvents {
45
47
  ready: () => void;
46
48
  resize: (height: number) => void;
47
49
  console: (type: 'log' | 'error' | 'info' | 'warn', message: any[]) => void;
@@ -53,7 +55,19 @@ export interface CoreIframeEvents {
53
55
  }
54
56
  export interface VueIframeContext extends CoreIframeContext {
55
57
  navigateTo: (to: string) => void;
58
+ getValue: (options: {
59
+ code: string;
60
+ path?: string;
61
+ onTemplateContext?: boolean;
62
+ context?: Record<string, any>;
63
+ }) => any;
56
64
  getInstanceData: (path: string /** filepath path of the component */) => Record<string, any>;
65
+ runCode: (options: {
66
+ path?: string;
67
+ code: string;
68
+ onTemplateContext?: boolean;
69
+ context?: Record<string, any>;
70
+ }) => any;
57
71
  /**
58
72
  * For virtual SFC preview
59
73
  *
@@ -67,7 +81,7 @@ export interface VueIframeEvents extends CoreIframeEvents {
67
81
  }
68
82
  export interface EditorContext {
69
83
  }
70
- export interface EditorEvents {
84
+ export interface EditorEvents extends RpcEvents {
71
85
  }
72
86
  export interface ElementPosition {
73
87
  top: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nookuio/iframe",
3
3
  "description": "",
4
- "version": "1.0.0",
4
+ "version": "1.0.1-beta.0",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "exports": {
@@ -30,7 +30,8 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "telejson": "7.2.0"
33
+ "telejson": "7.2.0",
34
+ "@nookuio/rpc": "1.0.1"
34
35
  },
35
36
  "devDependencies": {},
36
37
  "keywords": [],
@@ -1,51 +0,0 @@
1
- import type { ContextRequest, ContextResponse, EventRequest } from './types';
2
- type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
3
- type ClientReturnBase<R, L, RE, LE> = {
4
- [K in keyof R]: R[K] extends (...args: any[]) => any ? (...args: Parameters<R[K]>) => Promise<Awaited<ReturnType<R[K]>>> : R[K] extends any[] ? Promise<R[K]> : R[K] extends object ? ClientReturnBase<R[K], L, RE, LE> : Promise<R[K]>;
5
- };
6
- type ClientReturn<R, L, RE, LE> = ClientReturnBase<R, L, RE, LE> & {
7
- $context: L;
8
- on: <E extends keyof RE>(eventName: E, listener: (...args: ArgumentsType<RE[E]>) => void) => void;
9
- off: <E extends keyof RE>(eventName: E, listener: (...args: ArgumentsType<RE[E]>) => void) => void;
10
- emit: <E extends keyof LE>(eventName: E, ...args: ArgumentsType<LE[E]>) => void;
11
- removeAllListeners: () => void;
12
- };
13
- interface ClientOptions {
14
- /**
15
- * Function to send requests to the remote process
16
- *
17
- * Should return a ContextResponse
18
- */
19
- invoke: (request: ContextRequest) => Promise<ContextResponse>;
20
- /**
21
- * Function to handle incoming requests from the remote process
22
- *
23
- * Will be called only once at the start of the client
24
- */
25
- handle: (handler: (request: ContextRequest) => Promise<ContextResponse>) => void;
26
- /**
27
- * Function to emit events to the remote process
28
- */
29
- emit: (request: EventRequest) => void;
30
- /**
31
- * Function to handle events from the remote process
32
- *
33
- * Will be called only once at the start of the client
34
- */
35
- handleEvent: (handleRequest: (request: EventRequest) => void) => void;
36
- /**
37
- * Custom function to serialize data
38
- *
39
- * by default it uses JSON.stringify
40
- */
41
- serialize?: (data: any) => any;
42
- /**
43
- * Custom function to deserialize data
44
- *
45
- * by default it uses JSON.parse
46
- */
47
- deserialize?: (data: any) => any;
48
- }
49
- type Context = Record<string, any>;
50
- export declare function createClient<R extends Context, L extends Context, RE, LE>(localCtx: L, options: ClientOptions): ClientReturn<R, L, RE, LE>;
51
- export {};
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createClient = createClient;
7
- function createClient(y, l) {
8
- const {
9
- invoke: c,
10
- handle: f,
11
- emit: o,
12
- handleEvent: d,
13
- serialize: x,
14
- deserialize: v
15
- } = l;
16
- function g(e) {
17
- try {
18
- return x ? x(e) : JSON.stringify(e);
19
- } catch {
20
- return e;
21
- }
22
- }
23
- function R(e) {
24
- try {
25
- return v ? v(e) : JSON.parse(e);
26
- } catch {
27
- return e;
28
- }
29
- }
30
- const u = new Map();
31
- f(async e => {
32
- const n = p(y, e.key || "");
33
- if (n === void 0) return {
34
- type: "response",
35
- id: e.id,
36
- key: e.key,
37
- result: void 0
38
- };
39
- let r = e.args ? R(e.args) : [];
40
- Array.isArray(r) || (r = [r]);
41
- const s = typeof n == "function" ? await n(...r) : n;
42
- return {
43
- type: "response",
44
- id: e.id,
45
- key: e.key,
46
- result: g(s)
47
- };
48
- }), d(e => {
49
- const n = u.get(e.eventName);
50
- if (!n?.length) return;
51
- let r = e.args ? R(e.args) : [];
52
- Array.isArray(r) || (r = [r]), n.forEach(s => s(...r));
53
- });
54
- const E = new Map();
55
- function m(e) {
56
- const n = e.join(".");
57
- if (E.has(n)) return E.get(n);
58
- const r = async (...i) => {
59
- const t = {
60
- type: "request",
61
- id: `${n}-${Date.now()}-${Math.random()}`,
62
- key: n,
63
- args: g(i)
64
- },
65
- a = await c(t);
66
- return R(a.result);
67
- },
68
- s = new Proxy(r, {
69
- get(i, t) {
70
- if (t === "then") {
71
- const a = i();
72
- return a.then.bind(a);
73
- }
74
- if (t === "catch" || t === "finally") {
75
- const a = i();
76
- return a[t].bind(a);
77
- }
78
- return m([...e, t]);
79
- },
80
- apply(i, t, a) {
81
- return i.apply(t, a);
82
- }
83
- });
84
- return E.set(n, s), s;
85
- }
86
- return new Proxy({}, {
87
- get(e, n) {
88
- if (n === "$context") return y;
89
- if (n === "on") return (s, i) => {
90
- const t = u.get(s);
91
- if (!t) {
92
- u.set(s, [i]);
93
- return;
94
- }
95
- t.push(i);
96
- };
97
- if (n === "off") return (s, i) => {
98
- const t = u.get(s)?.indexOf(i);
99
- t === -1 || t === void 0 || u.get(s)?.splice(t, 1);
100
- };
101
- if (n === "emit") return (s, ...i) => {
102
- o({
103
- eventName: s,
104
- args: g(i)
105
- });
106
- };
107
- if (n === "removeAllListeners") return () => u.clear();
108
- if (typeof n != "symbol") return m([n]);
109
- }
110
- });
111
- }
112
- function p(y, l, c) {
113
- if (!y || typeof y != "object") return c;
114
- const f = Array.isArray(l) ? l : l.replace(/\[(\d+)]/g, ".$1").replace(/\["([^"]+)"\]/g, ".$1").replace(/\['([^']+)'\]/g, ".$1").split(".").filter(Boolean);
115
- let o = y;
116
- for (const d of f) if (o != null && typeof o == "object" && d in o) o = o[d];else return c;
117
- return o;
118
- }
@@ -1,114 +0,0 @@
1
- export function createClient(y, l) {
2
- const { invoke: c, handle: f, emit: o, handleEvent: d, serialize: x, deserialize: v } = l;
3
- function g(e) {
4
- try {
5
- return x ? x(e) : JSON.stringify(e);
6
- } catch {
7
- return e;
8
- }
9
- }
10
- function R(e) {
11
- try {
12
- return v ? v(e) : JSON.parse(e);
13
- } catch {
14
- return e;
15
- }
16
- }
17
- const u = /* @__PURE__ */ new Map();
18
- f(async (e) => {
19
- const n = p(y, e.key || "");
20
- if (n === void 0)
21
- return {
22
- type: "response",
23
- id: e.id,
24
- key: e.key,
25
- result: void 0
26
- };
27
- let r = e.args ? R(e.args) : [];
28
- Array.isArray(r) || (r = [r]);
29
- const s = typeof n == "function" ? await n(...r) : n;
30
- return {
31
- type: "response",
32
- id: e.id,
33
- key: e.key,
34
- result: g(s)
35
- };
36
- }), d((e) => {
37
- const n = u.get(e.eventName);
38
- if (!n?.length) return;
39
- let r = e.args ? R(e.args) : [];
40
- Array.isArray(r) || (r = [r]), n.forEach((s) => s(...r));
41
- });
42
- const E = /* @__PURE__ */ new Map();
43
- function m(e) {
44
- const n = e.join(".");
45
- if (E.has(n))
46
- return E.get(n);
47
- const r = async (...i) => {
48
- const t = {
49
- type: "request",
50
- id: `${n}-${Date.now()}-${Math.random()}`,
51
- // More robust ID
52
- key: n,
53
- args: g(i)
54
- }, a = await c(t);
55
- return R(a.result);
56
- }, s = new Proxy(r, {
57
- get(i, t) {
58
- if (t === "then") {
59
- const a = i();
60
- return a.then.bind(a);
61
- }
62
- if (t === "catch" || t === "finally") {
63
- const a = i();
64
- return a[t].bind(a);
65
- }
66
- return m([...e, t]);
67
- },
68
- apply(i, t, a) {
69
- return i.apply(t, a);
70
- }
71
- });
72
- return E.set(n, s), s;
73
- }
74
- return new Proxy(
75
- {},
76
- {
77
- get(e, n) {
78
- if (n === "$context") return y;
79
- if (n === "on")
80
- return (s, i) => {
81
- const t = u.get(s);
82
- if (!t) {
83
- u.set(s, [i]);
84
- return;
85
- }
86
- t.push(i);
87
- };
88
- if (n === "off")
89
- return (s, i) => {
90
- const t = u.get(s)?.indexOf(i);
91
- t === -1 || t === void 0 || u.get(s)?.splice(t, 1);
92
- };
93
- if (n === "emit")
94
- return (s, ...i) => {
95
- o({ eventName: s, args: g(i) });
96
- };
97
- if (n === "removeAllListeners") return () => u.clear();
98
- if (typeof n != "symbol")
99
- return m([n]);
100
- }
101
- }
102
- );
103
- }
104
- function p(y, l, c) {
105
- if (!y || typeof y != "object") return c;
106
- const f = Array.isArray(l) ? l : l.replace(/\[(\d+)]/g, ".$1").replace(/\["([^"]+)"\]/g, ".$1").replace(/\['([^']+)'\]/g, ".$1").split(".").filter(Boolean);
107
- let o = y;
108
- for (const d of f)
109
- if (o != null && typeof o == "object" && d in o)
110
- o = o[d];
111
- else
112
- return c;
113
- return o;
114
- }