svelte-origin 1.0.0-next.18 → 1.0.0-next.19
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 +26 -1
- package/dist/index.js +26 -1
- package/dist/plugin.js +26 -1
- package/dist/post-process.js +26 -1
- package/dist/preprocess.js +26 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2065,7 +2065,32 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
|
|
|
2065
2065
|
` + `})`);
|
|
2066
2066
|
}
|
|
2067
2067
|
} else {
|
|
2068
|
-
propsLines.push("
|
|
2068
|
+
propsLines.push("let __props = $state({ ...__inputAttrs })", "const __syncState = new Map()", `$effect.pre(() => {
|
|
2069
|
+
` + ` // Bidirectional sync between __inputAttrs and __props
|
|
2070
|
+
` + ` for (const key of Object.keys(__inputAttrs)) {
|
|
2071
|
+
` + ` const parentVal = __inputAttrs[key]
|
|
2072
|
+
` + ` const localVal = __props[key]
|
|
2073
|
+
` + ` const state = __syncState.get(key) ?? { parent: parentVal, local: localVal }
|
|
2074
|
+
` + ` __syncState.set(key, state)
|
|
2075
|
+
|
|
2076
|
+
` + ` // Parent changed -> update local
|
|
2077
|
+
` + ` if (parentVal !== state.parent) {
|
|
2078
|
+
` + ` state.parent = parentVal
|
|
2079
|
+
` + ` if (localVal !== parentVal) {
|
|
2080
|
+
` + ` __props[key] = parentVal
|
|
2081
|
+
` + ` state.local = parentVal
|
|
2082
|
+
` + ` }
|
|
2083
|
+
` + ` continue
|
|
2084
|
+
` + ` }
|
|
2085
|
+
|
|
2086
|
+
` + ` // Local changed -> update parent (for bindable props)
|
|
2087
|
+
` + ` if (localVal !== state.local) {
|
|
2088
|
+
` + ` state.local = localVal
|
|
2089
|
+
` + ` try { __inputAttrs[key] = localVal } catch {}
|
|
2090
|
+
` + ` state.parent = __inputAttrs[key]
|
|
2091
|
+
` + ` }
|
|
2092
|
+
` + ` }
|
|
2093
|
+
` + ` })`);
|
|
2069
2094
|
}
|
|
2070
2095
|
const propsObjectCode = "\t\t" + propsLines.join(`
|
|
2071
2096
|
`);
|
package/dist/index.js
CHANGED
|
@@ -6153,7 +6153,32 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
|
|
|
6153
6153
|
` + `})`);
|
|
6154
6154
|
}
|
|
6155
6155
|
} else {
|
|
6156
|
-
propsLines.push("
|
|
6156
|
+
propsLines.push("let __props = $state({ ...__inputAttrs })", "const __syncState = new Map()", `$effect.pre(() => {
|
|
6157
|
+
` + ` // Bidirectional sync between __inputAttrs and __props
|
|
6158
|
+
` + ` for (const key of Object.keys(__inputAttrs)) {
|
|
6159
|
+
` + ` const parentVal = __inputAttrs[key]
|
|
6160
|
+
` + ` const localVal = __props[key]
|
|
6161
|
+
` + ` const state = __syncState.get(key) ?? { parent: parentVal, local: localVal }
|
|
6162
|
+
` + ` __syncState.set(key, state)
|
|
6163
|
+
|
|
6164
|
+
` + ` // Parent changed -> update local
|
|
6165
|
+
` + ` if (parentVal !== state.parent) {
|
|
6166
|
+
` + ` state.parent = parentVal
|
|
6167
|
+
` + ` if (localVal !== parentVal) {
|
|
6168
|
+
` + ` __props[key] = parentVal
|
|
6169
|
+
` + ` state.local = parentVal
|
|
6170
|
+
` + ` }
|
|
6171
|
+
` + ` continue
|
|
6172
|
+
` + ` }
|
|
6173
|
+
|
|
6174
|
+
` + ` // Local changed -> update parent (for bindable props)
|
|
6175
|
+
` + ` if (localVal !== state.local) {
|
|
6176
|
+
` + ` state.local = localVal
|
|
6177
|
+
` + ` try { __inputAttrs[key] = localVal } catch {}
|
|
6178
|
+
` + ` state.parent = __inputAttrs[key]
|
|
6179
|
+
` + ` }
|
|
6180
|
+
` + ` }
|
|
6181
|
+
` + ` })`);
|
|
6157
6182
|
}
|
|
6158
6183
|
const propsObjectCode = "\t\t" + propsLines.join(`
|
|
6159
6184
|
`);
|
package/dist/plugin.js
CHANGED
|
@@ -2059,7 +2059,32 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
|
|
|
2059
2059
|
` + `})`);
|
|
2060
2060
|
}
|
|
2061
2061
|
} else {
|
|
2062
|
-
propsLines.push("
|
|
2062
|
+
propsLines.push("let __props = $state({ ...__inputAttrs })", "const __syncState = new Map()", `$effect.pre(() => {
|
|
2063
|
+
` + ` // Bidirectional sync between __inputAttrs and __props
|
|
2064
|
+
` + ` for (const key of Object.keys(__inputAttrs)) {
|
|
2065
|
+
` + ` const parentVal = __inputAttrs[key]
|
|
2066
|
+
` + ` const localVal = __props[key]
|
|
2067
|
+
` + ` const state = __syncState.get(key) ?? { parent: parentVal, local: localVal }
|
|
2068
|
+
` + ` __syncState.set(key, state)
|
|
2069
|
+
|
|
2070
|
+
` + ` // Parent changed -> update local
|
|
2071
|
+
` + ` if (parentVal !== state.parent) {
|
|
2072
|
+
` + ` state.parent = parentVal
|
|
2073
|
+
` + ` if (localVal !== parentVal) {
|
|
2074
|
+
` + ` __props[key] = parentVal
|
|
2075
|
+
` + ` state.local = parentVal
|
|
2076
|
+
` + ` }
|
|
2077
|
+
` + ` continue
|
|
2078
|
+
` + ` }
|
|
2079
|
+
|
|
2080
|
+
` + ` // Local changed -> update parent (for bindable props)
|
|
2081
|
+
` + ` if (localVal !== state.local) {
|
|
2082
|
+
` + ` state.local = localVal
|
|
2083
|
+
` + ` try { __inputAttrs[key] = localVal } catch {}
|
|
2084
|
+
` + ` state.parent = __inputAttrs[key]
|
|
2085
|
+
` + ` }
|
|
2086
|
+
` + ` }
|
|
2087
|
+
` + ` })`);
|
|
2063
2088
|
}
|
|
2064
2089
|
const propsObjectCode = "\t\t" + propsLines.join(`
|
|
2065
2090
|
`);
|
package/dist/post-process.js
CHANGED
|
@@ -2063,7 +2063,32 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
|
|
|
2063
2063
|
` + `})`);
|
|
2064
2064
|
}
|
|
2065
2065
|
} else {
|
|
2066
|
-
propsLines.push("
|
|
2066
|
+
propsLines.push("let __props = $state({ ...__inputAttrs })", "const __syncState = new Map()", `$effect.pre(() => {
|
|
2067
|
+
` + ` // Bidirectional sync between __inputAttrs and __props
|
|
2068
|
+
` + ` for (const key of Object.keys(__inputAttrs)) {
|
|
2069
|
+
` + ` const parentVal = __inputAttrs[key]
|
|
2070
|
+
` + ` const localVal = __props[key]
|
|
2071
|
+
` + ` const state = __syncState.get(key) ?? { parent: parentVal, local: localVal }
|
|
2072
|
+
` + ` __syncState.set(key, state)
|
|
2073
|
+
|
|
2074
|
+
` + ` // Parent changed -> update local
|
|
2075
|
+
` + ` if (parentVal !== state.parent) {
|
|
2076
|
+
` + ` state.parent = parentVal
|
|
2077
|
+
` + ` if (localVal !== parentVal) {
|
|
2078
|
+
` + ` __props[key] = parentVal
|
|
2079
|
+
` + ` state.local = parentVal
|
|
2080
|
+
` + ` }
|
|
2081
|
+
` + ` continue
|
|
2082
|
+
` + ` }
|
|
2083
|
+
|
|
2084
|
+
` + ` // Local changed -> update parent (for bindable props)
|
|
2085
|
+
` + ` if (localVal !== state.local) {
|
|
2086
|
+
` + ` state.local = localVal
|
|
2087
|
+
` + ` try { __inputAttrs[key] = localVal } catch {}
|
|
2088
|
+
` + ` state.parent = __inputAttrs[key]
|
|
2089
|
+
` + ` }
|
|
2090
|
+
` + ` }
|
|
2091
|
+
` + ` })`);
|
|
2067
2092
|
}
|
|
2068
2093
|
const propsObjectCode = "\t\t" + propsLines.join(`
|
|
2069
2094
|
`);
|
package/dist/preprocess.js
CHANGED
|
@@ -2059,7 +2059,32 @@ function transformOriginBody(content, parents = [], attrDetails = [], propName =
|
|
|
2059
2059
|
` + `})`);
|
|
2060
2060
|
}
|
|
2061
2061
|
} else {
|
|
2062
|
-
propsLines.push("
|
|
2062
|
+
propsLines.push("let __props = $state({ ...__inputAttrs })", "const __syncState = new Map()", `$effect.pre(() => {
|
|
2063
|
+
` + ` // Bidirectional sync between __inputAttrs and __props
|
|
2064
|
+
` + ` for (const key of Object.keys(__inputAttrs)) {
|
|
2065
|
+
` + ` const parentVal = __inputAttrs[key]
|
|
2066
|
+
` + ` const localVal = __props[key]
|
|
2067
|
+
` + ` const state = __syncState.get(key) ?? { parent: parentVal, local: localVal }
|
|
2068
|
+
` + ` __syncState.set(key, state)
|
|
2069
|
+
|
|
2070
|
+
` + ` // Parent changed -> update local
|
|
2071
|
+
` + ` if (parentVal !== state.parent) {
|
|
2072
|
+
` + ` state.parent = parentVal
|
|
2073
|
+
` + ` if (localVal !== parentVal) {
|
|
2074
|
+
` + ` __props[key] = parentVal
|
|
2075
|
+
` + ` state.local = parentVal
|
|
2076
|
+
` + ` }
|
|
2077
|
+
` + ` continue
|
|
2078
|
+
` + ` }
|
|
2079
|
+
|
|
2080
|
+
` + ` // Local changed -> update parent (for bindable props)
|
|
2081
|
+
` + ` if (localVal !== state.local) {
|
|
2082
|
+
` + ` state.local = localVal
|
|
2083
|
+
` + ` try { __inputAttrs[key] = localVal } catch {}
|
|
2084
|
+
` + ` state.parent = __inputAttrs[key]
|
|
2085
|
+
` + ` }
|
|
2086
|
+
` + ` }
|
|
2087
|
+
` + ` })`);
|
|
2063
2088
|
}
|
|
2064
2089
|
const propsObjectCode = "\t\t" + propsLines.join(`
|
|
2065
2090
|
`);
|