hyperapp-is 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -522,11 +522,12 @@ localState: { histories: string[] }
522
522
  ```ts
523
523
  export const HistoryInput = function <S> (
524
524
  props: {
525
- state : S
526
- id : string
527
- keyNames : Keys_String
528
- historyLimit?: number
529
- [key: string]: any
525
+ state : S
526
+ id : string
527
+ keyNames : Keys_String
528
+ historyLimit ?: number
529
+ afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>[]) => VNode<S>[]
530
+ [key: string] : any
530
531
  }
531
532
  ): VNode<S>[]
532
533
  ```
@@ -536,6 +537,7 @@ export const HistoryInput = function <S> (
536
537
  - props.id : ユニークID
537
538
  - props.keyNames: ステート内の文字までのパス
538
539
  - props.historyLimit: 保持する履歴の最大数 (default = 10)
540
+ - props.afterRender : 全体のレンダーフック
539
541
  - returns : [HTMLInputElement, HTMLDataListElement]
540
542
 
541
543
  履歴は `[props.id].histories` に保存されます
@@ -60,5 +60,6 @@ export declare const HistoryInput: <S>(props: {
60
60
  id: string;
61
61
  keyNames: Keys_String;
62
62
  historyLimit?: number;
63
+ afterRender?: (state: S, localState: Record<string, any>, vnode: VNode<S>[]) => VNode<S>[];
63
64
  [key: string]: any;
64
65
  }) => VNode<S>[];
@@ -167,7 +167,7 @@ export const OptionButton = function (props, children) {
167
167
  * @returns {VNode<S>[]} - [HTMLInputElement, HTMLDataListElement]
168
168
  */
169
169
  export const HistoryInput = function (props) {
170
- const { state, id, keyNames, historyLimit = 10 } = props;
170
+ const { state, id, keyNames, historyLimit = 10, afterRender } = props;
171
171
  const value = getValue(state, keyNames, "");
172
172
  const localState = getLocalState(state, id, {
173
173
  histories: []
@@ -209,10 +209,10 @@ export const HistoryInput = function (props) {
209
209
  // ---------- ---------- ----------
210
210
  // VNode
211
211
  // ---------- ---------- ----------
212
- return [
212
+ const vnode = [
213
213
  input({
214
214
  type: "text",
215
- ...deleteKeys(props, "state", "keyNames", "historyLimit"),
215
+ ...deleteKeys(props, "state", "keyNames", "historyLimit", "afterRender"),
216
216
  list: `${id}-history`,
217
217
  value,
218
218
  oninput,
@@ -224,4 +224,7 @@ export const HistoryInput = function (props) {
224
224
  value: item
225
225
  })))
226
226
  ];
227
+ return afterRender
228
+ ? afterRender(state, localState, vnode)
229
+ : vnode;
227
230
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperapp-is",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "UI foundation library for Hyperapp by is4416",
5
5
  "license": "MIT",
6
6
  "type": "module",