plugins: HFS.Icon

Massimo Melina committed May 20, 2023 at 15:16 UTC 9b14e8b3fae576903a71a0ac637bb559bce09f46
2 files changed +4 -2
dev-plugins.md
+3 -1
@@ -154,6 +154,8 @@ The HFS objects contains many properties:
154 - `h` shortcut for React.createElement
155 - `t` [translator function](https://github.com/rejetto/hfs/blob/main/frontend/src/i18n.ts)
156 - `_` [lodash library](https://lodash.com/docs/)
157 +- `Icon` component for icons. Properties:
158 + - `name: string` refer to file `icons.ts` for names, but you can also enter an emoji instead.
159
160 ### Front-end API events
161
@@ -254,7 +256,7 @@ HFS will scan through them in inverted alphabetical order searching for a compat
256 - full URL support for frontend_js and frontend_css
257 - custom.html
258 - entry.cantOpen
257 - - HFS.apiCall, reloadList, logout, h, React, state, t, _, dialogLib
259 + - HFS.apiCall, reloadList, logout, h, React, state, t, _, dialogLib, Icon
260 - second parameter of onEvent is now deprecated
261 - renamed: additionalEntryProps > additionalEntryDetails & entry-props > entry-details
262 - entryIcon event
frontend/src/misc.ts
+1 -1
@@ -58,7 +58,7 @@ export function hfsEvent(name: string, params?:Dict) {
58 return output
59 }
60
61 -const tools = { h, React, state, t, _, dialogLib, apiCall, reloadList, logout }
61 +const tools = { h, React, state, t, _, dialogLib, apiCall, reloadList, logout, Icon, hIcon }
62 Object.assign((window as any).HFS ||= {}, {
63 ...tools,
64 onEvent(name: string, cb: (params:any, tools: any, output:any) => any) {