Commit Graph

29 Commits

Author SHA1 Message Date
filtered
cc5aece6b6 [API] Mark ContextMenu methods as deprecated, cleanup (#948)
- Marks unused static methods as deprecated
- Removes redundant / orphaned code
- Uses existing AbortController to remove all root listeners
2025-04-20 11:25:25 +00:00
filtered
c77082fe2f Close context menus on any click outside the menu (#895)
Current: Right click in e.g. `textarea` leaves litegraph context menus
open.
Proposed: Any click anywhere outside the context menu (or its sub-menus)
will close all context menus.
2025-04-06 13:30:42 +00:00
filtered
4589938ceb [TS] Fix invalid type assertion (#731)
- Follow-up on #728
2025-03-10 08:55:51 +00:00
VeeloxShadow
acdbbd547e Fix downstream extension context menu does not load (#728)
- Adds optional chaining for event target
2025-03-10 19:41:46 +11:00
filtered
af7db40fce [chore] Clean up ignores after strict mode enabled (#680)
- Replaces all `ts-ignore` with `ts-expect-error`
- Resolves https://github.com/Comfy-Org/litegraph.js/issues/578
2025-03-02 14:56:15 +00:00
filtered
c473130499 [TS] Use strict mode in LGraphCanvas (#654)
- Prefer creating HTML elements in JS and `append()` over innerHTML &
`querySelector()`
- Removes redundant code
- Adds/fixes TS types
2025-03-01 11:52:42 +00:00
filtered
b36bf3d4a2 [CodeHealth] Apply modern standards to LGraphCanvas (#650)
- Prefer template string
- Prefer explicit throw to undefined TypeError
- Remove unnecessary `this` assignment
2025-02-28 22:08:23 +00:00
filtered
c4faaf4210 [TS] Fix ContextMenu types (#649)
- No runtime changes
- Drastically improves ContextMenu type accuracy / safety
- Allows TS strict conversion
2025-02-28 14:52:07 +00:00
filtered
1e8938ceff Add unicorn lint rules - DOM built-in functions (#628)
- Prefer append(), remove(), replaceAll()
- Wrap nested ternaries in parenthesis
2025-02-27 09:18:25 +00:00
filtered
a43109d58a [TS] Use strict mode in ContextMenu (#618)
- Adds minor type coercions to resolve type errors
- Uses the same type-coercion behaviour of the target DOM object
properties
- Resolves a long-standing type issue in context menu interfaces
(converts to generic - `unknown` by default)
- Fixes several incorrect types
- Adds ts-ignore that must be removed later
2025-02-26 14:29:45 +00:00
filtered
5cdd0581fa Add import / export sort rules (#612)
- Adds ESLint package
- Applies import/export rules to all files
- Uses newline delineated grouping, with type-only imports first
2025-02-26 09:21:33 +00:00
filtered
9ded97d189 [Doc] Add JSDoc linter & general comment clean up (#611)
- Prefer comments above lines over end-of-line comments
  - Makes auto-formatting easier
  - Subjective, but it is generally easier to read in JS
- Standardises JSdoc format
- Auto-fixes for many issues (applies on save w/ESLint extension)
2025-02-26 08:54:18 +00:00
filtered
4636367de2 [TS] Use strict mode in LGraphNode - initial (#598)
- Part of effort to convert LGraphNode to TS strict
- Adds some small runtime changes - no impact expected, but it is
possible
- Runtime changes are in separate commits from compile-time type changes
- Risk of downstream impact is low
2025-02-25 17:19:27 +00:00
filtered
4163cb04b8 [Refactor] Prefer modern for..of loops (#566)
- Replaces traditional incrementing `for` loops and `forEach()` calls with modern `for..of` syntax
- Improves readability
- Semantic checking used; not expecting issues to arise from this portion
2025-02-23 19:59:41 +00:00
filtered
b67f34e7f3 [Cleanup] Remove lint bypass, remove unused vars (#554) 2025-02-20 11:17:35 +11:00
Chenlei Hu
4844311f3b Add ts-strict-ignore plugin (#443)
* Add ts-strict-ignore plugin

* nit
2025-02-03 15:49:58 -05:00
bymyself
9a8c3dff89 Remove scaling of context menus (#431)
* remove scaling of context menus based on graph scale

* deprecate scale in interface

* Add option to restore old context scaling behaviour

Revert "remove scaling of context menus based on graph scale"

This reverts commit d91ecaa86c671aea272844c3900a18da1af7bf01.

* Update test expectations

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2025-01-27 19:41:08 +11:00
bymyself
bee9c18a31 Enhance context menu scrolling behavior (#414) 2025-01-02 14:57:05 -05:00
filtered
802e734657 Fix deeply nested context menus remain open (#399)
* nit - Remove redundant workaround

* Fix deeply nested context menus remain open
2024-12-27 13:52:35 -05:00
filtered
0b161c1195 Fix scaled font blurriness in context menus (#400)
Requires that fonts scale in increments of 0.25.
2024-12-27 13:51:53 -05:00
filtered
f79133659f Clean up JSDoc (#327)
* Convert comments to JSDoc

* Clean JSdoc

* nit

* Clean up all JSDoc & ESLint warnings

Disables max-len for now
Removes redundant JSDoc tags (empty, same name, wrong name, etc)
2024-11-21 10:11:53 -05:00
filtered
5469bfdd52 Add ESLint, pre-commit hook & format all files (#319)
* Add ESLint config

* Add ESLint packages

* Add prettier config

* Fix ESLint package version

* Format all files

* Format static assets

* Format project root config

* Add pre-commit code formatting

Formats .css & .js files automatically.  If any .ts or .mts files are staged, the entire project is type-checked.

Packages:
- lint-staged
- husky
- prettier
2024-11-20 21:50:58 -05:00
Chenlei Hu
7c0240857c Revert branch to cb6e80a645 (#257) 2024-11-03 09:12:47 -05:00
dmx
79c53e0095 (prettier formatting) 2024-11-03 09:20:57 +04:00
filtered
4d87476905 Typescript ContextMenu (#206)
* Format only

* Refactor TS narrowing & coercion

* nit - Refactor

* nit - Refactor

* Refactor optional chaining

* Add TS narrowing

* nit - Add base interface

* Add TS types

* Refactor - TS type narrowing

* Convert to arrow funcs for this ref
2024-10-12 11:00:50 -04:00
filtered
5d510cd674 Revert "Format all code with prettier (#197)" (#198)
This reverts commit 28382b7e45.
2024-10-08 13:14:36 -04:00
Chenlei Hu
28382b7e45 Format all code with prettier (#197)
* Add formatter support

* Format all code

* Fix moved @ts-expect-error
2024-10-07 14:06:44 -04:00
Chenlei Hu
142c22ea41 Typescript conversion 0.7.84 (#194)
* Convert litegraph.js to TS

* Overhaul static litegraph.d.ts with updated types

* Fix rename oversights and revert fix unused param

- Some functions were broken by merging updated TS function signatures which included param renames
- Removal of unused params does not belong in the TS conversion PR, and has been reverted

* Remove legacy static .d.ts file

* Add callback decl from #180

Support allowing links to widgets (#180)
c23e610c11

* Convert NodeId to string | number

Results in significantly less downstream changes, despite being a change from the old static file.

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
2024-10-07 11:15:29 -04:00
filtered
c71b86da1f Split ContextMenu out to TS file 2024-09-27 09:56:19 +09:00