Comparing version 5.0.0-next.230 to 5.0.0-next.231
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.230", | ||
"version": "5.0.0-next.231", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -151,3 +151,3 @@ declare module '*.svelte' { | ||
*/ | ||
export function link<T>(value: T, callback?: (value: T) => void): T; | ||
export function link<T>(value: T): T; | ||
@@ -154,0 +154,0 @@ export function raw<T>(initial: T): T; |
@@ -77,2 +77,3 @@ /** @import { CallExpression, VariableDeclarator } from 'estree' */ | ||
case '$state.raw': | ||
case '$state.link': | ||
case '$derived': | ||
@@ -89,3 +90,3 @@ case '$derived.by': | ||
e.rune_invalid_arguments_length(node, rune, 'exactly one argument'); | ||
} else if (rune === '$state' && node.arguments.length > 1) { | ||
} else if ((rune === '$state' || rune === '$state.link') && node.arguments.length > 1) { | ||
e.rune_invalid_arguments_length(node, rune, 'zero or one arguments'); | ||
@@ -92,0 +93,0 @@ } |
@@ -134,7 +134,3 @@ /** @import { CallExpression, Expression, Identifier, Literal, VariableDeclaration, VariableDeclarator } from 'estree' */ | ||
if (rune === '$state.link') { | ||
value = b.call( | ||
'$.source_link', | ||
b.thunk(value), | ||
args.length === 2 && /** @type {Expression} */ (context.visit(args[1])) | ||
); | ||
value = b.call('$.source_link', b.thunk(value)); | ||
} else if (is_state_source(binding, context.state.analysis)) { | ||
@@ -141,0 +137,0 @@ value = b.call('$.source', value); |
@@ -52,8 +52,6 @@ /** @import { Derived, Effect, Source, Value } from '#client' */ | ||
* @param {() => V} get_value | ||
* @param {(value: V) => void} [callback] | ||
* @returns {(value?: V) => V} | ||
*/ | ||
export function source_link(get_value, callback) { | ||
export function source_link(get_value) { | ||
var was_local = false; | ||
var init = false; | ||
var local_source = source(/** @type {V} */ (undefined)); | ||
@@ -81,16 +79,3 @@ | ||
var linked_value = get(linked_derived); | ||
if (init) { | ||
if (callback !== undefined) { | ||
untrack(() => callback(linked_value)); | ||
return local_source.v; | ||
} | ||
} else { | ||
init = true; | ||
} | ||
local_source.v = linked_value; | ||
return linked_value; | ||
return (local_source.v = get(linked_derived)); | ||
}; | ||
@@ -97,0 +82,0 @@ } |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.230'; | ||
export const VERSION = '5.0.0-next.231'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2208782
48989