fix(types): upgrade sveld and type constant props as accessors (#742)

This commit is contained in:
Eric Liu 2021-07-11 07:21:50 -07:00 committed by GitHub
commit 54e1e07872
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 63 additions and 61 deletions

View file

@ -43,7 +43,7 @@
"rollup-plugin-svelte": "^7.1.0", "rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"sass": "^1.32.6", "sass": "^1.32.6",
"sveld": "0.8.1", "sveld": "^0.8.2",
"svelte": "^3.32.1", "svelte": "^3.32.1",
"svelte-check": "^1.1.32", "svelte-check": "^1.1.32",
"typescript": "^4.1.3" "typescript": "^4.1.3"

View file

@ -16,13 +16,6 @@ export interface BreakpointProps {
* @default { sm: false, md: false, lg: false, xlg: false, max: false, } * @default { sm: false, md: false, lg: false, xlg: false, max: false, }
*/ */
sizes?: Record<BreakpointSize, boolean>; sizes?: Record<BreakpointSize, boolean>;
/**
* Reference the Carbon grid breakpoints
* @constant
* @default { sm: 320, md: 672, lg: 1056, xlg: 1312, max: 1584, }
*/
breakpoints?: { sm: 320; md: 672; lg: 1056; xlg: 1312; max: 1584 };
} }
export default class Breakpoint extends SvelteComponentTyped< export default class Breakpoint extends SvelteComponentTyped<
@ -34,4 +27,11 @@ export default class Breakpoint extends SvelteComponentTyped<
}>; }>;
}, },
{ default: { size: BreakpointSize; sizes: Record<BreakpointSize, boolean> } } { default: { size: BreakpointSize; sizes: Record<BreakpointSize, boolean> } }
> {} > {
/**
* Reference the Carbon grid breakpoints
* @constant
* @default { sm: 320, md: 672, lg: 1056, xlg: 1312, max: 1584, }
*/
breakpoints: Record<BreakpointSize, BreakpointValue>;
}

View file

@ -27,13 +27,6 @@ export interface FileUploaderProps
*/ */
multiple?: boolean; multiple?: boolean;
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles?: () => void;
/** /**
* Specify the label description * Specify the label description
* @default "" * @default ""
@ -84,4 +77,11 @@ export default class FileUploader extends SvelteComponentTyped<
keydown: WindowEventMap["keydown"]; keydown: WindowEventMap["keydown"];
}, },
{} {}
> {} > {
/**
* Override the default behavior of clearing the array of uploaded files
* @constant
* @default () => { files = []; }
*/
clearFiles: () => void;
}

View file

@ -44,17 +44,17 @@ export interface ImageLoaderProps
* @default false * @default false
*/ */
fadeIn?: boolean; fadeIn?: boolean;
/**
* Method invoked to load the image provided a `src` value
* @constant
* @default (url) => { if (image != null) image = null; loaded = false; error = false; image = new Image(); image.src = url || src; image.onload = () => (loaded = true); image.onerror = () => (error = true); }
*/
loadImage?: (url?: string) => void;
} }
export default class ImageLoader extends SvelteComponentTyped< export default class ImageLoader extends SvelteComponentTyped<
ImageLoaderProps, ImageLoaderProps,
{ load: CustomEvent<any>; error: CustomEvent<any> }, { load: CustomEvent<any>; error: CustomEvent<any> },
{ error: {}; loading: {} } { error: {}; loading: {} }
> {} > {
/**
* Method invoked to load the image provided a `src` value
* @constant
* @default (url) => { if (image != null) image = null; loaded = false; error = false; image = new Image(); image.src = url || src; image.onload = () => (loaded = true); image.onerror = () => (error = true); }
*/
loadImage: (url?: string) => void;
}

View file

@ -23,13 +23,6 @@ export interface ListBoxFieldProps
*/ */
tabindex?: string; tabindex?: string;
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds?: { close: "close"; open: "open" };
/** /**
* Override the default translation ids * Override the default translation ids
* @default (id) => defaultTranslations[id] * @default (id) => defaultTranslations[id]
@ -61,4 +54,11 @@ export default class ListBoxField extends SvelteComponentTyped<
blur: WindowEventMap["blur"]; blur: WindowEventMap["blur"];
}, },
{ default: {} } { default: {} }
> {} > {
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds: { close: "close"; open: "open" };
}

View file

@ -11,13 +11,6 @@ export interface ListBoxMenuIconProps
*/ */
open?: boolean; open?: boolean;
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds?: { close: "close"; open: "open" };
/** /**
* Override the default translation ids * Override the default translation ids
* @default (id) => defaultTranslations[id] * @default (id) => defaultTranslations[id]
@ -29,4 +22,11 @@ export default class ListBoxMenuIcon extends SvelteComponentTyped<
ListBoxMenuIconProps, ListBoxMenuIconProps,
{ click: WindowEventMap["click"] }, { click: WindowEventMap["click"] },
{} {}
> {} > {
/**
* Default translation ids
* @constant
* @default { close: "close", open: "open" }
*/
translationIds: { close: "close"; open: "open" };
}

View file

@ -16,13 +16,6 @@ export interface ListBoxSelectionProps
*/ */
disabled?: boolean; disabled?: boolean;
/**
* Default translation ids
* @constant
* @default { clearAll: "clearAll", clearSelection: "clearSelection", }
*/
translationIds?: { clearAll: "clearAll"; clearSelection: "clearSelection" };
/** /**
* Override the default translation ids * Override the default translation ids
* @default (id) => defaultTranslations[id] * @default (id) => defaultTranslations[id]
@ -40,4 +33,11 @@ export default class ListBoxSelection extends SvelteComponentTyped<
ListBoxSelectionProps, ListBoxSelectionProps,
{ clear: CustomEvent<any> }, { clear: CustomEvent<any> },
{} {}
> {} > {
/**
* Default translation ids
* @constant
* @default { clearAll: "clearAll", clearSelection: "clearSelection", }
*/
translationIds: { clearAll: "clearAll"; clearSelection: "clearSelection" };
}

View file

@ -25,11 +25,13 @@ export default class LocalStorage extends SvelteComponentTyped<
> { > {
/** /**
* Remove the persisted key value from the browser's local storage * Remove the persisted key value from the browser's local storage
* @default () => { localStorage.removeItem(key); }
*/ */
clearItem: () => void; clearItem: () => void;
/** /**
* Clear all key values from the browser's local storage * Clear all key values from the browser's local storage
* @default () => { localStorage.clear(); }
*/ */
clearAll: () => void; clearAll: () => void;
} }

View file

@ -122,13 +122,6 @@ export interface NumberInputProps
*/ */
translateWithId?: (id: NumberInputTranslationId) => string; translateWithId?: (id: NumberInputTranslationId) => string;
/**
* Default translation ids
* @constant
* @default { increment: "increment", decrement: "decrement", }
*/
translationIds?: { increment: "increment"; decrement: "decrement" };
/** /**
* Set an id for the input element * Set an id for the input element
* @default "ccs-" + Math.random().toString(36) * @default "ccs-" + Math.random().toString(36)
@ -158,4 +151,11 @@ export default class NumberInput extends SvelteComponentTyped<
input: WindowEventMap["input"]; input: WindowEventMap["input"];
}, },
{ label: {} } { label: {} }
> {} > {
/**
* Default translation ids
* @constant
* @default { increment: "increment", decrement: "decrement", }
*/
translationIds: { increment: "increment"; decrement: "decrement" };
}

View file

@ -2383,10 +2383,10 @@ supports-color@^7.0.0, supports-color@^7.1.0:
dependencies: dependencies:
has-flag "^4.0.0" has-flag "^4.0.0"
sveld@0.8.1: sveld@^0.8.2:
version "0.8.1" version "0.8.2"
resolved "https://registry.yarnpkg.com/sveld/-/sveld-0.8.1.tgz#9fcd23efdb350500337ac1ec041647b0a8dac49d" resolved "https://registry.yarnpkg.com/sveld/-/sveld-0.8.2.tgz#979324cb058846ca686f563012e4615e35093094"
integrity sha512-OtOEYDNFcjL9tmTvIJ+Iwt9nwN9NfClf5iP0bHGQRZzfSIlxY1lnl81cdMPgNz54ef5Sdibw7g4ham/MK+Spzw== integrity sha512-oMv33rOc1jr4sV0gBozx4HJgDb6XAqelLgZn6ME4RgvFnK5mPWR/5On1LfMvFPXZVZMWac0id8VJVJMZVYPcNA==
dependencies: dependencies:
"@rollup/plugin-node-resolve" "^11.0.1" "@rollup/plugin-node-resolve" "^11.0.1"
acorn "^8.0.4" acorn "^8.0.4"