* Improve typings for ItemList
* Add new `.replace()` syntax
* Update JSDoc
* Add missing `T` type
* Fix typo
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
* Allow choice to not set `itemName` property when calling `toArray`
* Make `ItemList.items` read-only
* Modify `.replace()`; add `.changePriority()`
* Complete rename
* Update JSDoc
* Add `.toObject()` method; deprecate `.items`
* Rewrite `.toArray()` to use Proxy instead of modifying the item content
- Fixes#3030
- Fixes issue where setting `itemName` property could result in errors depending on the object type (e.g. proxies)
- Fixes unneeded duplication of item list
- Add option to disable setting `itemName` property on primitives
* Simplify condition
* Remove debug code
* Make proxying function protected instead of private
* Update a usage of ItemList as an example
* Make `itemName` property read-only
* Use correct capitalisation of `object`
* Invert `toArray` parameter function
* Simplify isEmpty check
* Update ItemList.ts
* Fix `merge()`
* Remove extra JSDoc comment
* Use `._items` directly for merging
* Rename methods: `replace` -> `set`; `changePriority` -> `setPriority`
This more closely matches our existing method names (`get()`)
* Change `items` getter
* Simplify proxying
* Update URL to source function
* Update compat
* Various changes to toObject
* Remove `Item.key`
* Make item content proxy method private
* Enforce merge typings
* Update TSDoc comments to use `{@link}` for references to methods
* Correct references to deprecated `.replace` method
* Throw error when setting content/priority of non-existent items
* Remove intermediary variable
* Update TSDoc block
* Update js/src/@types/global.d.ts
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
* chore: migrate to Yarn package manager
* chore: bump deps, move `expose-loader` to correct deps section
* fix: remove package from old typescript shim
* feat: use Yarn Plug'n'Play
* chore: keep `node_modules` ignored for people who choose to use npm anyway
* Revert "feat: use Yarn Plug'n'Play"
This reverts commit 9781c8c8d5.
* feat: allow use of any tag in `listItems` helper
* fix: fix missing optional chaining
* chore: use more optional chaining
* fix: various typings errors
* chore: replace `Vnode[]` with `Children`
* Allow using file extension in core compat imports
Necessary for extend imports to have proper typings as we also have an unrelated extend/index.js file
* Add .ts file extension to extend imports for typings
* Fix changes to proxifyCompat regex breaking non-core import paths
* Move utility types to global types
Co-authored-by: David Wheatley <hi@davwheat.dev>
* Rename files
* Rewrite common Application to TS
* Improve DefaultResolver typings
* Convert mapRoutes to TS
* Fix incorrect JSDoc type
* Add missing default value
* Add debug button string to localisations
* WIP Forum application TS rewrite
* Use union and intersection to remove property duplication
* Address some review comments
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
* Address some review comments
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
* Fix build error
* Address some review comments
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
* Add `type` import qualifier
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
Needed for https://github.com/flarum/core/issues/3043.
Some posts are loaded dynamically, and won't be immediately available. In this case, we show a loading indicator instead of displaying content. In this PR:
- We redraw post content if loading state has chnaged
- We show a loading indicator while loading