@getforma/core 0.8.1 → 0.9.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/dist/runtime.js CHANGED
@@ -2468,6 +2468,23 @@ function mountScope(root) {
2468
2468
  }
2469
2469
  const scope = initScope(root);
2470
2470
  const disposers = [];
2471
+ const refsMap = /* @__PURE__ */ new Map();
2472
+ const refEls = root.querySelectorAll("[data-ref]");
2473
+ for (let i = 0; i < refEls.length; i++) {
2474
+ const el = refEls[i];
2475
+ const name = el.getAttribute("data-ref");
2476
+ if (name) refsMap.set(name, el);
2477
+ }
2478
+ const rootRefName = root.getAttribute("data-ref");
2479
+ if (rootRefName) refsMap.set(rootRefName, root);
2480
+ scope.getters["$refs"] = () => new Proxy({}, {
2481
+ get(_, name) {
2482
+ return refsMap.get(name) ?? void 0;
2483
+ },
2484
+ has(_, name) {
2485
+ return refsMap.has(name);
2486
+ }
2487
+ });
2471
2488
  bindElement(root, scope, disposers);
2472
2489
  let boundCount = 0;
2473
2490
  const selector = buildDirectiveSelector();