Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function invalidate(renderer, scope, node, names, main_execution_context
* @param {import('./Renderer.js').default} renderer
* @param {string} name
* @param {any} [value]
* @param {boolean} main_execution_context
* @param {boolean} [main_execution_context]
* @returns {import('estree').Node}
*/
export function renderer_invalidate(renderer, name, value, main_execution_context = false) {
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/compiler/preprocess/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ async function process_markup(process, source) {
/**
* @param {string} source
* @param {import('./public.js').PreprocessorGroup | import('./public.js').PreprocessorGroup[]} preprocessor
* @param {{ filename?: string }} options
* @param {{ filename?: string }} [options]
* @returns {Promise<import('./public.js').Processed>}
*/
export default async function preprocess(source, preprocessor, options) {
Expand Down
4 changes: 4 additions & 0 deletions packages/svelte/src/runtime/internal/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ if (typeof HTMLElement === 'function') {
node.setAttribute('name', name);
}
},
/**
* @param {HTMLElement} target
* @param {HTMLElement} [anchor]
*/
m: function mount(target, anchor) {
insert(target, node, anchor);
},
Expand Down
20 changes: 10 additions & 10 deletions packages/svelte/src/runtime/internal/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ensure_array_like } from './each.js';
/**
* @template T
* @param {string} type
* @param {T} detail
* @param {T} [detail]
* @returns {void}
*/
export function dispatch_dev(type, detail) {
Expand Down Expand Up @@ -47,7 +47,7 @@ export function append_hydration_dev(target, node) {
/**
* @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @param {Node} [anchor]
* @returns {void}
*/
export function insert_dev(target, node, anchor) {
Expand All @@ -57,7 +57,7 @@ export function insert_dev(target, node, anchor) {

/** @param {Node} target
* @param {Node} node
* @param {Node} anchor
* @param {Node} [anchor]
* @returns {void}
*/
export function insert_hydration_dev(target, node, anchor) {
Expand Down Expand Up @@ -109,10 +109,10 @@ export function detach_after_dev(before) {
* @param {Node} node
* @param {string} event
* @param {EventListenerOrEventListenerObject} handler
* @param {boolean | AddEventListenerOptions | EventListenerOptions} options
* @param {boolean} has_prevent_default
* @param {boolean} has_stop_propagation
* @param {boolean} has_stop_immediate_propagation
* @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]
* @param {boolean} [has_prevent_default]
* @param {boolean} [has_stop_propagation]
* @param {boolean} [has_stop_immediate_propagation]
* @returns {() => void}
*/
export function listen_dev(
Expand Down Expand Up @@ -140,7 +140,7 @@ export function listen_dev(
/**
* @param {Element} node
* @param {string} attribute
* @param {string} value
* @param {string} [value]
* @returns {void}
*/
export function attr_dev(node, attribute, value) {
Expand All @@ -152,7 +152,7 @@ export function attr_dev(node, attribute, value) {
/**
* @param {Element} node
* @param {string} property
* @param {any} value
* @param {any} [value]
* @returns {void}
*/
export function prop_dev(node, property, value) {
Expand All @@ -163,7 +163,7 @@ export function prop_dev(node, property, value) {
/**
* @param {HTMLElement} node
* @param {string} property
* @param {any} value
* @param {any} [value]
* @returns {void}
*/
export function dataset_dev(node, property, value) {
Expand Down
4 changes: 3 additions & 1 deletion packages/svelte/src/runtime/internal/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,11 +1001,13 @@ export function toggle_class(element, name, toggle) {
* @template T
* @param {string} type
* @param {T} [detail]
* @param {{ bubbles?: boolean, cancelable?: boolean }} [options]
* @returns {CustomEvent<T>}
*/
export function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
/**
* @type {CustomEvent<T>} */
* @type {CustomEvent<T>}
*/
const e = document.createEvent('CustomEvent');
e.initCustomEvent(type, bubbles, cancelable, detail);
return e;
Expand Down
3 changes: 2 additions & 1 deletion packages/svelte/src/runtime/internal/transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export function transition_in(block, local) {
/**
* @param {import('./private.js').Fragment} block
* @param {0 | 1} local
* @param {0 | 1} detach
* @param {0 | 1} [detach]
* @param {() => void} [callback]
* @returns {void}
*/
export function transition_out(block, local, detach, callback) {
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/runtime/motion/tweened.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function tweened(value, defaults = {}) {
let target_value = value;
/**
* @param {T} new_value
* @param {import('./private.js').TweenedOptions<T>} opts
* @param {import('./private.js').TweenedOptions<T>} [opts]
*/
function set(new_value, opts) {
if (value == null) {
Expand Down
14 changes: 8 additions & 6 deletions packages/svelte/src/runtime/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const subscriber_queue = [];
/**
* Creates a `Readable` store that allows reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @param {T} [value] initial value
* @param {import('./public.js').StartStopNotifier<T>} [start]
* @returns {import('./public.js').Readable<T>}
*/
export function readable(value, start) {
Expand All @@ -25,8 +25,8 @@ export function readable(value, start) {
/**
* Create a `Writable` store that allows both updating and reading by subscription.
* @template T
* @param {T} value initial value
* @param {import('./public.js').StartStopNotifier<T>} start
* @param {T} [value] initial value
* @param {import('./public.js').StartStopNotifier<T>} [start]
* @returns {import('./public.js').Writable<T>}
*/
export function writable(value, start = noop) {
Expand Down Expand Up @@ -56,16 +56,18 @@ export function writable(value, start = noop) {
}
}
}

/**
* @param {import('./public.js').Updater<T>} fn
* @returns {void}
*/
function update(fn) {
set(fn(value));
}

/**
* @param {import('./public.js').Subscriber<T>} run
* @param {import('./private.js').Invalidator<T>} invalidate
* @param {import('./private.js').Invalidator<T>} [invalidate]
* @returns {import('./public.js').Unsubscriber}
*/
function subscribe(run, invalidate = noop) {
Expand Down Expand Up @@ -95,7 +97,7 @@ export function writable(value, start = noop) {
* @template T
* @overload
* @param {S} stores - input stores
* @param {(values: import('./public.js').StoresValues<S>, set: import('./public.js').Subscriber<T>, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values
* @param {(values: import('./public.js').StoresValues<S>, set: (value: T) => void, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values
* @param {T} [initial_value] - initial value
* @returns {import('./public.js').Readable<T>}
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/runtime/store/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type Updater<T> = (value: T) => T;
* This function is called when the first subscriber subscribes.
*
* @param {(value: T) => void} set Function that sets the value of the store.
* @param {(value: Updater<T>) => void} set Function that sets the value of the store after passing the current value to the update function.
* @param {(value: Updater<T>) => void} update Function that sets the value of the store after passing the current value to the update function.
* @returns {void | (() => void)} Optionally, a cleanup function that is called when the last remaining
* subscriber unsubscribes.
*/
Expand Down