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