svelte-origin 1.0.0-next.18 → 1.0.0-next.20

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/cli.js CHANGED
@@ -2032,38 +2032,13 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
2032
2032
  const hasParents = parents.length > 0;
2033
2033
  const propsLines = [];
2034
2034
  if (attrDetails.length > 0) {
2035
- const initialProps = [];
2035
+ const propDefs = [];
2036
2036
  for (const attr of attrDetails) {
2037
2037
  const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2038
- initialProps.push(`${attr.key}: __inputAttrs.${attr.key}${defaultExpr}`);
2039
- }
2040
- propsLines.push(`let __props = $state({ ${initialProps.join(", ")} })`);
2041
- for (const attr of attrDetails) {
2042
- const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2043
- const parentLast = `__last_parent_${attr.key}`;
2044
- const localLast = `__last_local_${attr.key}`;
2045
- propsLines.push(`let ${parentLast} = __inputAttrs.${attr.key}`, `let ${localLast} = __props.${attr.key}`, `$effect(() => {
2046
- ` + ` const __parent = __inputAttrs.${attr.key}
2047
- ` + ` const __local = __props.${attr.key}
2048
-
2049
- ` + ` // Parent -> local
2050
- ` + ` if (__parent !== ${parentLast}) {
2051
- ` + ` ${parentLast} = __parent
2052
- ` + ` if (__local !== __parent) {
2053
- ` + ` __props.${attr.key} = __parent${defaultExpr}
2054
- ` + ` }
2055
- ` + ` ${localLast} = __props.${attr.key}
2056
- ` + ` return
2057
- ` + ` }
2058
-
2059
- ` + ` // Local -> parent
2060
- ` + ` if (__local !== ${localLast}) {
2061
- ` + ` ${localLast} = __local
2062
- ` + (attr.bindable ? ` try { __inputAttrs.${attr.key} = __local } catch {}
2063
- ${parentLast} = __inputAttrs.${attr.key}
2064
- ` : "") + ` }
2065
- ` + `})`);
2038
+ propDefs.push(`get ${attr.key}() { return __inputAttrs.${attr.key}${defaultExpr} }`);
2039
+ propDefs.push(`set ${attr.key}(v) { __inputAttrs.${attr.key} = v }`);
2066
2040
  }
2041
+ propsLines.push(`const __props = { ${propDefs.join(", ")} }`);
2067
2042
  } else {
2068
2043
  propsLines.push("const __props = __inputAttrs");
2069
2044
  }
package/dist/index.js CHANGED
@@ -6120,38 +6120,13 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
6120
6120
  const hasParents = parents.length > 0;
6121
6121
  const propsLines = [];
6122
6122
  if (attrDetails.length > 0) {
6123
- const initialProps = [];
6123
+ const propDefs = [];
6124
6124
  for (const attr2 of attrDetails) {
6125
6125
  const defaultExpr = attr2.hasDefault ? ` ?? ${attr2.defaultValue}` : "";
6126
- initialProps.push(`${attr2.key}: __inputAttrs.${attr2.key}${defaultExpr}`);
6127
- }
6128
- propsLines.push(`let __props = $state({ ${initialProps.join(", ")} })`);
6129
- for (const attr2 of attrDetails) {
6130
- const defaultExpr = attr2.hasDefault ? ` ?? ${attr2.defaultValue}` : "";
6131
- const parentLast = `__last_parent_${attr2.key}`;
6132
- const localLast = `__last_local_${attr2.key}`;
6133
- propsLines.push(`let ${parentLast} = __inputAttrs.${attr2.key}`, `let ${localLast} = __props.${attr2.key}`, `$effect(() => {
6134
- ` + ` const __parent = __inputAttrs.${attr2.key}
6135
- ` + ` const __local = __props.${attr2.key}
6136
-
6137
- ` + ` // Parent -> local
6138
- ` + ` if (__parent !== ${parentLast}) {
6139
- ` + ` ${parentLast} = __parent
6140
- ` + ` if (__local !== __parent) {
6141
- ` + ` __props.${attr2.key} = __parent${defaultExpr}
6142
- ` + ` }
6143
- ` + ` ${localLast} = __props.${attr2.key}
6144
- ` + ` return
6145
- ` + ` }
6146
-
6147
- ` + ` // Local -> parent
6148
- ` + ` if (__local !== ${localLast}) {
6149
- ` + ` ${localLast} = __local
6150
- ` + (attr2.bindable ? ` try { __inputAttrs.${attr2.key} = __local } catch {}
6151
- ${parentLast} = __inputAttrs.${attr2.key}
6152
- ` : "") + ` }
6153
- ` + `})`);
6126
+ propDefs.push(`get ${attr2.key}() { return __inputAttrs.${attr2.key}${defaultExpr} }`);
6127
+ propDefs.push(`set ${attr2.key}(v) { __inputAttrs.${attr2.key} = v }`);
6154
6128
  }
6129
+ propsLines.push(`const __props = { ${propDefs.join(", ")} }`);
6155
6130
  } else {
6156
6131
  propsLines.push("const __props = __inputAttrs");
6157
6132
  }
package/dist/plugin.js CHANGED
@@ -2026,38 +2026,13 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
2026
2026
  const hasParents = parents.length > 0;
2027
2027
  const propsLines = [];
2028
2028
  if (attrDetails.length > 0) {
2029
- const initialProps = [];
2029
+ const propDefs = [];
2030
2030
  for (const attr of attrDetails) {
2031
2031
  const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2032
- initialProps.push(`${attr.key}: __inputAttrs.${attr.key}${defaultExpr}`);
2033
- }
2034
- propsLines.push(`let __props = $state({ ${initialProps.join(", ")} })`);
2035
- for (const attr of attrDetails) {
2036
- const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2037
- const parentLast = `__last_parent_${attr.key}`;
2038
- const localLast = `__last_local_${attr.key}`;
2039
- propsLines.push(`let ${parentLast} = __inputAttrs.${attr.key}`, `let ${localLast} = __props.${attr.key}`, `$effect(() => {
2040
- ` + ` const __parent = __inputAttrs.${attr.key}
2041
- ` + ` const __local = __props.${attr.key}
2042
-
2043
- ` + ` // Parent -> local
2044
- ` + ` if (__parent !== ${parentLast}) {
2045
- ` + ` ${parentLast} = __parent
2046
- ` + ` if (__local !== __parent) {
2047
- ` + ` __props.${attr.key} = __parent${defaultExpr}
2048
- ` + ` }
2049
- ` + ` ${localLast} = __props.${attr.key}
2050
- ` + ` return
2051
- ` + ` }
2052
-
2053
- ` + ` // Local -> parent
2054
- ` + ` if (__local !== ${localLast}) {
2055
- ` + ` ${localLast} = __local
2056
- ` + (attr.bindable ? ` try { __inputAttrs.${attr.key} = __local } catch {}
2057
- ${parentLast} = __inputAttrs.${attr.key}
2058
- ` : "") + ` }
2059
- ` + `})`);
2032
+ propDefs.push(`get ${attr.key}() { return __inputAttrs.${attr.key}${defaultExpr} }`);
2033
+ propDefs.push(`set ${attr.key}(v) { __inputAttrs.${attr.key} = v }`);
2060
2034
  }
2035
+ propsLines.push(`const __props = { ${propDefs.join(", ")} }`);
2061
2036
  } else {
2062
2037
  propsLines.push("const __props = __inputAttrs");
2063
2038
  }
@@ -2030,38 +2030,13 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
2030
2030
  const hasParents = parents.length > 0;
2031
2031
  const propsLines = [];
2032
2032
  if (attrDetails.length > 0) {
2033
- const initialProps = [];
2033
+ const propDefs = [];
2034
2034
  for (const attr of attrDetails) {
2035
2035
  const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2036
- initialProps.push(`${attr.key}: __inputAttrs.${attr.key}${defaultExpr}`);
2037
- }
2038
- propsLines.push(`let __props = $state({ ${initialProps.join(", ")} })`);
2039
- for (const attr of attrDetails) {
2040
- const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2041
- const parentLast = `__last_parent_${attr.key}`;
2042
- const localLast = `__last_local_${attr.key}`;
2043
- propsLines.push(`let ${parentLast} = __inputAttrs.${attr.key}`, `let ${localLast} = __props.${attr.key}`, `$effect(() => {
2044
- ` + ` const __parent = __inputAttrs.${attr.key}
2045
- ` + ` const __local = __props.${attr.key}
2046
-
2047
- ` + ` // Parent -> local
2048
- ` + ` if (__parent !== ${parentLast}) {
2049
- ` + ` ${parentLast} = __parent
2050
- ` + ` if (__local !== __parent) {
2051
- ` + ` __props.${attr.key} = __parent${defaultExpr}
2052
- ` + ` }
2053
- ` + ` ${localLast} = __props.${attr.key}
2054
- ` + ` return
2055
- ` + ` }
2056
-
2057
- ` + ` // Local -> parent
2058
- ` + ` if (__local !== ${localLast}) {
2059
- ` + ` ${localLast} = __local
2060
- ` + (attr.bindable ? ` try { __inputAttrs.${attr.key} = __local } catch {}
2061
- ${parentLast} = __inputAttrs.${attr.key}
2062
- ` : "") + ` }
2063
- ` + `})`);
2036
+ propDefs.push(`get ${attr.key}() { return __inputAttrs.${attr.key}${defaultExpr} }`);
2037
+ propDefs.push(`set ${attr.key}(v) { __inputAttrs.${attr.key} = v }`);
2064
2038
  }
2039
+ propsLines.push(`const __props = { ${propDefs.join(", ")} }`);
2065
2040
  } else {
2066
2041
  propsLines.push("const __props = __inputAttrs");
2067
2042
  }
@@ -2026,38 +2026,13 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
2026
2026
  const hasParents = parents.length > 0;
2027
2027
  const propsLines = [];
2028
2028
  if (attrDetails.length > 0) {
2029
- const initialProps = [];
2029
+ const propDefs = [];
2030
2030
  for (const attr of attrDetails) {
2031
2031
  const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2032
- initialProps.push(`${attr.key}: __inputAttrs.${attr.key}${defaultExpr}`);
2033
- }
2034
- propsLines.push(`let __props = $state({ ${initialProps.join(", ")} })`);
2035
- for (const attr of attrDetails) {
2036
- const defaultExpr = attr.hasDefault ? ` ?? ${attr.defaultValue}` : "";
2037
- const parentLast = `__last_parent_${attr.key}`;
2038
- const localLast = `__last_local_${attr.key}`;
2039
- propsLines.push(`let ${parentLast} = __inputAttrs.${attr.key}`, `let ${localLast} = __props.${attr.key}`, `$effect(() => {
2040
- ` + ` const __parent = __inputAttrs.${attr.key}
2041
- ` + ` const __local = __props.${attr.key}
2042
-
2043
- ` + ` // Parent -> local
2044
- ` + ` if (__parent !== ${parentLast}) {
2045
- ` + ` ${parentLast} = __parent
2046
- ` + ` if (__local !== __parent) {
2047
- ` + ` __props.${attr.key} = __parent${defaultExpr}
2048
- ` + ` }
2049
- ` + ` ${localLast} = __props.${attr.key}
2050
- ` + ` return
2051
- ` + ` }
2052
-
2053
- ` + ` // Local -> parent
2054
- ` + ` if (__local !== ${localLast}) {
2055
- ` + ` ${localLast} = __local
2056
- ` + (attr.bindable ? ` try { __inputAttrs.${attr.key} = __local } catch {}
2057
- ${parentLast} = __inputAttrs.${attr.key}
2058
- ` : "") + ` }
2059
- ` + `})`);
2032
+ propDefs.push(`get ${attr.key}() { return __inputAttrs.${attr.key}${defaultExpr} }`);
2033
+ propDefs.push(`set ${attr.key}(v) { __inputAttrs.${attr.key} = v }`);
2060
2034
  }
2035
+ propsLines.push(`const __props = { ${propDefs.join(", ")} }`);
2061
2036
  } else {
2062
2037
  propsLines.push("const __props = __inputAttrs");
2063
2038
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-origin",
3
- "version": "1.0.0-next.18",
3
+ "version": "1.0.0-next.20",
4
4
  "description": "Compiler-assisted state and prop ergonomics for Svelte 5",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",