Repository navigation
Releases: knitkode/kit
Release list
@knitkode/utils@3.0.1
Patch Changes
-
113cd75Thanks @kuus! - Fix several helpers:isExternalUrlcompares against the givencurrentUrl(it used to always fall back tolocation.href) and works outside the browser. It only matches URLs starting withhttp(s)://, compares hosts case-insensitively and supports hosts without a dot such aslocalhost.isServerNowandisBrowserNowno longer throw wherewindowis not declared, like in Node.js.roundrounds whendecimalsis falsy (round(1.7)is2, it used to truncate to1). WithtrailingZeroesit returns the formatted string (round(1.2, 2, true)is"1.20"), the only way to keep the zeroes.ensureInttruncates numbers like it already did with strings (ensureInt(1.9)is1, it used to round to2). Non numeric input givesNaN.slugifyreplaces underscores and the other punctuation with the separator (slugify("foo_bar")is"foo-bar").removeAccentskeeps the case of the replaced letters ("École"gives"Ecole", it used to give"ecole").titleCasecapitalises words starting with any letter ("élan vital"gives"Élan Vital").isFloat(Infinity)isfalse.- The
Splittype matches the runtime for empty strings and trailing delimiters (split("a,", ",")is typed["a", ""]). encodeencodes line breaks and characters from code point 1000 up (€, CJK, emoji), which it used to corrupt, anddecodereverses them. The output of the other characters is unchanged, anddecodestill reads values encoded by previous versions.
-
89e3ba6Thanks @kuus! - Fix more helpers:throttlepasses its arguments to the throttled function (it used to throw or drop them), which also fixes the throttled listeners of@knitkode/dom.- Cookies:
setCookieapplies the defaultpath=/and writesexpires(days orDate) correctly, soremoveCookiereally removes the cookie.setCookieno longer throws wheredocumentis not declared. getNoncereturnsnullinstead of throwing where__webpack_nonce__is not declared.objectFlatkeepsnullvalues instead of throwing,objectMergeWithDefaultsno longer mutates the defaults and appliesdeleteIfNullto nested objects,objectSortByKeysMatchingalways puts the matching key first.removeDuplicatesByKeycompares values withSameValueZero(1and"1"are different, keys like"toString"are kept).chunkByChunksreturns the requested number of chunks in unbalanced mode,chunkBySizewith a size below 1 returns the whole array (it used to loop forever).createPalettekeeps the order of the given shades.- URLs:
buildUrlQueryStringencodes the keys too,getUrlQueryParamsignores the hash and decodes the keys,getUrlHashPathnamestrips the#and the leading slashes,getParamAsIntreturns the fallback for non numeric values,parseURLreturnsnullfor invalid ports. debouncePromisewithisImmediatesettles the promises of the calls made during the wait, with the immediate call result.invariantis typed as an assertion and its messages follow the documented[lib:prefix]: messageformat ("Invariant failed"without a message).- Types:
Defer()type-checks as documented andDeferredhas itspromise,ArrayOfAllresolves to"Incomplete"for incomplete lists.
-
b131ad6Thanks @kuus! - ExportchangeCaseCapital,changeCaseNone,changeCasePascalSnake,removeDuplicatesandrenderfrom the package root. They were only available from their own subpaths (e.g.@knitkode/utils/render), which still work.
@knitkode/react@3.0.1
Patch Changes
-
113cd75Thanks @kuus! -decodeFormonly reads the encoded input names and ignores the plain (honeypot) ones explicitly, instead of relying ondecodemangling them. It keeps working with thedecodeof this release, which leaves non encoded text as it is. -
f1c0e3aThanks @kuus! - Fix hooks, components and the calendar:classedkeeps the text after the last interpolation, and its ref and event handlers are typed with the element type.createUseMediaQueryWidthsupports the"@md"shorthand (same as"@min-md").extendComponentapplies its default props on React 19.useMeasurereports the size changes of every instance's element,useFixedOffsetcomputes the offset with the given selector, and both work whereResizeObserveris missing.useSmoothScrollsubtracts the fixed offset for numeric targets too, and never scrolls below 0.NoJsswapsno-jsforjswithout breaking the other classes. Its inline script changed: update its hash if a Content-Security-Policy allows it by hash.Metaallows zooming whenzoomis set.useFocusreturns a tuple and accepts the element type,useIntervalaccepts anulldelay.- Calendar: hiding a calendar no longer hides the events of the other ones, the default components no longer pass
$props to the DOM (no more React warnings), multi-day events keep free rows (no more overlaps and duplicate keys), timed events show on their last day, all-day Google events show on the right day in every timezone, events of calendars missing fromcalendarsMapare shown instead of crashing, and the default navigation title is visible. useCalendarmerges the giveneventswith the fetched ones, callsonErrorfor failing calendars, shows the Google calendar names incalendarsMap, switches view from the displayed range, keeps the clicked event on "today" and no longer mutates the given calendars and dates.
-
Updated dependencies [
a04e3ff,113cd75,89e3ba6,b131ad6]:- @knitkode/dom@3.0.1
- @knitkode/utils@3.0.1
@knitkode/node@3.0.1
Patch Changes
-
1ad3640Thanks @kuus! -getDependencyVersionaccepts a{ from }option with the directory to resolve the dependency from, e.g.getDependencyVersion("next", { from: "./apps/web" })orgetDependencyVersion("next", "major", { from }). By default it now resolves from the current working directory instead of from where@knitkode/nodeis installed, so it finds the project's own dependencies with strictnode_moduleslayouts such as pnpm's. -
113cd75Thanks @kuus! - Fix several helpers:fsMoveAndRestoreTemporaryPathsandfsMoveAndRestoreTemporaryPathsSyncmove the paths out of the destination while the callback runs (they used to copy them), always restore them, even when the callback throws or a path is missing, and run the callback once when there are no paths (it used to run twice).fsFindUpSyncalso searches thestopAtdirectory and the file system root.fsWriteandfsWriteSynconly drop the leading blank lines, keeping the indentation of the first line.swcCreateTransformmaps root imports of nested libraries without a double slash (@org/ui/Button, it used to give@org/ui//Button), andswcTransformsKitonly rewrites root imports, the sub paths of the@knitkode/*packages being entry points already.
-
Updated dependencies [
113cd75,89e3ba6,b131ad6]:- @knitkode/utils@3.0.1
@knitkode/dom@3.0.1
Patch Changes
-
a04e3ffThanks @kuus! - Fix the event helpers and a few DOM utilities:- The unbind functions returned by
on,listenScroll,listenScrollDebouncedandlistenScrollThrottledremove listeners added with capture (they used to do nothing), andonce(el, type, fn, true)fires only once. unlistenmatches callbacks by reference instead of by their source code, removes only the matching listener (it used to drop every listener of a type that had just one), and can remove alistenOncelistener given its original callback. A new function with the same body as the registered one no longer removes it.- Delegated listeners: a
listenOncecallback no longer makes the next listener skip the event, and listeners with a selector no longer throw for events fired onwindowordocument. getListenersreturns copies, mutating them no longer changes the registry.addClassandremoveClasscalled without a class name do nothing instead of throwing.getScrollbarWidth(element)returns the element's scrollbar width (offsetWidth - clientWidth).isNodeListreturnsfalsefor array-like plain objects.listenLoadedcalled after theDOMContentLoadedevent still runs its handler (asynchronously).getOffsetno longer subtracts the element's own scroll position, only its offset parents'.
- The unbind functions returned by
-
Updated dependencies [
113cd75,89e3ba6,b131ad6]:- @knitkode/utils@3.0.1
@knitkode/browser@3.0.1
Patch Changes
113cd75Thanks @kuus! - FixnavigateToHash, which doubled the?of the current query string (/page??a=1#hash), and make the storage helpers (storageClient,storage,createStorage) return stored falsy values (0,false,"") instead ofnullor the default, and apply falsy defaults ingetAll.- Updated dependencies [
a04e3ff,113cd75,89e3ba6,b131ad6]:- @knitkode/dom@3.0.1
- @knitkode/utils@3.0.1
@knitkode/api@3.0.1
Patch Changes
113cd75Thanks @kuus! - Fix the requests URL, which got a double slash with an endpoint starting with/or a base URL ending with one, and let the headers passed to a request override the client ones (the client headers used to win).- Updated dependencies [
113cd75,89e3ba6,b131ad6]:- @knitkode/utils@3.0.1
@knitkode/utils@3.0.0
Major Changes
-
2f0b11eThanks @kuus! - First release under the@knitkodenpm scope. These packages were previously published as@koine/*(last version2.0.0-beta.217). Follow the migration guide to upgrade.- Packages are renamed from
@koine/<name>to@knitkode/<name>.@koine/i18nand@koine/nextare not part of kit: internationalization now lives in the separate Koine project. - Packages are ESM-only, with no CommonJS builds. Bundlers need no changes. Node.js can still
require()them from 20.19 / 22.12. TypeScript users needmoduleResolutionset tobundler,node16ornodenext. - Only the documented entry points can be imported: the package root and one subpath per module, e.g.
@knitkode/utils/isArray. The old*.cjs.jsand*.esm.jsfiles and internal paths are gone. - Renamed exports:
KoineComponent→KitComponent,KoineComponentProps→KitComponentProps,KoineCalendar*→KitCalendar*(@knitkode/react), the globalKoine.Apinamespace →Kit.Api(@knitkode/api/typings),swcTransformsKoine→swcTransformsKit(@knitkode/node/swc). - Removed subpaths:
@koine/api/swr/createSwrApi(use@knitkode/api/swr),@koine/api/swr-mutation/createSwrApi(use@knitkode/api/swr-mutation) and the empty@koine/utils/without. @knitkode/domexports theEventCallbackandListenEventtypes (from the package root) used bylisten,listenOnce,unlistenandgetListeners. Their declarations used to reference these types without shipping them.@knitkode/api/typingsnow resolves undernode16andnodenextmodule resolution.- Packages are MIT licensed and published from CI with npm provenance.
- Packages are renamed from
@knitkode/react@3.0.0
Major Changes
-
2f0b11eThanks @kuus! - First release under the@knitkodenpm scope. These packages were previously published as@koine/*(last version2.0.0-beta.217). Follow the migration guide to upgrade.- Packages are renamed from
@koine/<name>to@knitkode/<name>.@koine/i18nand@koine/nextare not part of kit: internationalization now lives in the separate Koine project. - Packages are ESM-only, with no CommonJS builds. Bundlers need no changes. Node.js can still
require()them from 20.19 / 22.12. TypeScript users needmoduleResolutionset tobundler,node16ornodenext. - Only the documented entry points can be imported: the package root and one subpath per module, e.g.
@knitkode/utils/isArray. The old*.cjs.jsand*.esm.jsfiles and internal paths are gone. - Renamed exports:
KoineComponent→KitComponent,KoineComponentProps→KitComponentProps,KoineCalendar*→KitCalendar*(@knitkode/react), the globalKoine.Apinamespace →Kit.Api(@knitkode/api/typings),swcTransformsKoine→swcTransformsKit(@knitkode/node/swc). - Removed subpaths:
@koine/api/swr/createSwrApi(use@knitkode/api/swr),@koine/api/swr-mutation/createSwrApi(use@knitkode/api/swr-mutation) and the empty@koine/utils/without. @knitkode/domexports theEventCallbackandListenEventtypes (from the package root) used bylisten,listenOnce,unlistenandgetListeners. Their declarations used to reference these types without shipping them.@knitkode/api/typingsnow resolves undernode16andnodenextmodule resolution.- Packages are MIT licensed and published from CI with npm provenance.
- Packages are renamed from
Patch Changes
2f0b11eThanks @kuus! -KitCalendarDaygridTablepasseskeyto its week rows and day cells as a prop of its own instead of inside spread props, fixing React's "A props object containing a "key" prop is being spread into JSX" warning. TheTableBodyCellandTableBodyCellDateslot props now declare thechildrenthey receive.- Updated dependencies [
2f0b11e]:- @knitkode/dom@3.0.0
- @knitkode/utils@3.0.0
@knitkode/node@3.0.0
Major Changes
-
2f0b11eThanks @kuus! - First release under the@knitkodenpm scope. These packages were previously published as@koine/*(last version2.0.0-beta.217). Follow the migration guide to upgrade.- Packages are renamed from
@koine/<name>to@knitkode/<name>.@koine/i18nand@koine/nextare not part of kit: internationalization now lives in the separate Koine project. - Packages are ESM-only, with no CommonJS builds. Bundlers need no changes. Node.js can still
require()them from 20.19 / 22.12. TypeScript users needmoduleResolutionset tobundler,node16ornodenext. - Only the documented entry points can be imported: the package root and one subpath per module, e.g.
@knitkode/utils/isArray. The old*.cjs.jsand*.esm.jsfiles and internal paths are gone. - Renamed exports:
KoineComponent→KitComponent,KoineComponentProps→KitComponentProps,KoineCalendar*→KitCalendar*(@knitkode/react), the globalKoine.Apinamespace →Kit.Api(@knitkode/api/typings),swcTransformsKoine→swcTransformsKit(@knitkode/node/swc). - Removed subpaths:
@koine/api/swr/createSwrApi(use@knitkode/api/swr),@koine/api/swr-mutation/createSwrApi(use@knitkode/api/swr-mutation) and the empty@koine/utils/without. @knitkode/domexports theEventCallbackandListenEventtypes (from the package root) used bylisten,listenOnce,unlistenandgetListeners. Their declarations used to reference these types without shipping them.@knitkode/api/typingsnow resolves undernode16andnodenextmodule resolution.- Packages are MIT licensed and published from CI with npm provenance.
- Packages are renamed from
Patch Changes
2f0b11eThanks @kuus! -getDependencyVersionreads the dependency's ownpackage.jsoninstead of the first one above its entry file. Dual packages that ship nestedpackage.jsonfiles, likeglob'sdist/commonjs/package.json, no longer return-1. Subpath specifiers such asreact-dom/clientresolve to their package version.- Updated dependencies [
2f0b11e]:- @knitkode/utils@3.0.0
@knitkode/dom@3.0.0
Major Changes
-
2f0b11eThanks @kuus! - First release under the@knitkodenpm scope. These packages were previously published as@koine/*(last version2.0.0-beta.217). Follow the migration guide to upgrade.- Packages are renamed from
@koine/<name>to@knitkode/<name>.@koine/i18nand@koine/nextare not part of kit: internationalization now lives in the separate Koine project. - Packages are ESM-only, with no CommonJS builds. Bundlers need no changes. Node.js can still
require()them from 20.19 / 22.12. TypeScript users needmoduleResolutionset tobundler,node16ornodenext. - Only the documented entry points can be imported: the package root and one subpath per module, e.g.
@knitkode/utils/isArray. The old*.cjs.jsand*.esm.jsfiles and internal paths are gone. - Renamed exports:
KoineComponent→KitComponent,KoineComponentProps→KitComponentProps,KoineCalendar*→KitCalendar*(@knitkode/react), the globalKoine.Apinamespace →Kit.Api(@knitkode/api/typings),swcTransformsKoine→swcTransformsKit(@knitkode/node/swc). - Removed subpaths:
@koine/api/swr/createSwrApi(use@knitkode/api/swr),@koine/api/swr-mutation/createSwrApi(use@knitkode/api/swr-mutation) and the empty@koine/utils/without. @knitkode/domexports theEventCallbackandListenEventtypes (from the package root) used bylisten,listenOnce,unlistenandgetListeners. Their declarations used to reference these types without shipping them.@knitkode/api/typingsnow resolves undernode16andnodenextmodule resolution.- Packages are MIT licensed and published from CI with npm provenance.
- Packages are renamed from
Patch Changes
- Updated dependencies [
2f0b11e]:- @knitkode/utils@3.0.0