@opentf/web 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @opentf/web
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 476d65a: Fix reactivity issues by re-exporting all signals from the core package and updating the compiler to use a unified reactivity instance. This prevents state-update failures in complex project structures.
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
@@ -114,9 +114,9 @@ module.exports = function (babel) {
114
114
  state.stateVars.add(parent.node.id.name);
115
115
  }
116
116
  if (name === "$state") {
117
- path.get("callee").replaceWith(getImport("signal", "@preact/signals-core"));
117
+ path.get("callee").replaceWith(getImport("signal", state.runtimeSource));
118
118
  } else if (name === "$derived") {
119
- path.get("callee").replaceWith(getImport("computed", "@preact/signals-core"));
119
+ path.get("callee").replaceWith(getImport("computed", state.runtimeSource));
120
120
  } else if (name === "$ref") {
121
121
  // Track this variable as a ref variable
122
122
  const parent = path.findParent(p => p.isVariableDeclarator());
@@ -126,10 +126,10 @@ module.exports = function (babel) {
126
126
  if (!state.stateVars) state.stateVars = new Set();
127
127
  state.stateVars.add(parent.node.id.name);
128
128
  }
129
- path.get("callee").replaceWith(getImport("signal", "@preact/signals-core"));
129
+ path.get("callee").replaceWith(getImport("signal", state.runtimeSource));
130
130
  }
131
131
  } else if (name === "$effect") {
132
- path.get("callee").replaceWith(getImport("effect", "@preact/signals-core"));
132
+ path.get("callee").replaceWith(getImport("effect", state.runtimeSource));
133
133
  } else if (name === "$expose") {
134
134
  // $expose({ a, b }) -> Object.assign(this, { a, b })
135
135
  path.get("callee").replaceWith(t.memberExpression(t.identifier("Object"), t.identifier("assign")));
@@ -360,7 +360,7 @@ module.exports = function (babel) {
360
360
  // Transform to Web Component Class
361
361
  const tagName = "web-" + name.toLowerCase();
362
362
  const observedAttributes = Array.from(allSignals);
363
- const signalId = getImport("signal", "@preact/signals-core");
363
+ const signalId = getImport("signal", state.runtimeSource);
364
364
  const createPropsProxyId = getImport("createPropsProxy", state.runtimeSource);
365
365
  const classId = t.identifier(name + "Element");
366
366
 
@@ -548,7 +548,7 @@ module.exports = function (babel) {
548
548
  return;
549
549
  }
550
550
  collectSignals(value.expression);
551
- const effectId = getImport("effect", "@preact/signals-core");
551
+ const effectId = getImport("effect", state.runtimeSource);
552
552
  statements.push(t.expressionStatement(t.callExpression(effectId, [
553
553
  t.arrowFunctionExpression([], t.assignmentExpression("=", t.memberExpression(elId, t.identifier(targetProp)), value.expression))
554
554
  ])));
@@ -607,7 +607,7 @@ module.exports = function (babel) {
607
607
 
608
608
  collectSignals(value.expression);
609
609
 
610
- const effectId = getImport("effect", "@preact/signals-core");
610
+ const effectId = getImport("effect", state.runtimeSource);
611
611
  const attrProp = (name === "class" || name === "classname") ? "className" : name;
612
612
  const isStyle = attrProp === "style";
613
613
  const isProperty = ["className", "style", "value", "checked", "id", "title", "href", "src", "key"].includes(attrProp);
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from '@preact/signals-core';
1
2
  export { mountApp } from './core/mount.js';
2
3
  export * from './runtime/dom.js';
3
4
  export * from './runtime/lifecycle.js';
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentf/web",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "The core engine of the Web App Framework, including the zero-VDOM compiler and signal-based runtime.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,7 +1,4 @@
1
- import { createPropsProxy as _createPropsProxy, withInstance as _withInstance } from "../index.js";
2
- import { signal as _signal } from "@preact/signals-core";
3
- import { renderDynamic as _renderDynamic } from "../index.js";
4
- import { effect as _effect } from "@preact/signals-core";
1
+ import { effect as _effect, renderDynamic as _renderDynamic, signal as _signal, createPropsProxy as _createPropsProxy, withInstance as _withInstance } from "../index.js";
5
2
  import { navigate } from "./index";
6
3
  class LinkElement extends HTMLElement {
7
4
  static observedAttributes = ["href", "className", "style", "children"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentf/web",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "The core engine of the Web App Framework, including the zero-VDOM compiler and signal-based runtime.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",