hyperapp-is 0.1.24 → 0.1.25

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
@@ -614,26 +614,29 @@ export const getParentItems = (
614
614
  ```ts
615
615
  export const NavigatorFinder = function <S> (
616
616
  props: {
617
- state : S
618
- id : string
619
- currentKeys : Keys_NavigatorItem
620
- columns ?: (directory: NavigatorItem | undefined) => NavigatorColumn[]
621
- plugIn ?: (props: {
622
- state : S
623
- localState: Record<string, any>
624
- }) => VNode<S>[]
625
- afterRender ?: (state: S, localState: Recrod<string, any>, vnode: VNode<S>) => VNode<S>
617
+ state : S
618
+ id : string
619
+ currentKeys : Keys_NavigatorItem
620
+ columns ?: (directory: NavigatorItem | undefined) => NavigatorColumn[]
621
+ plugIn ?: (state: S, localState: Record<string, any>) => VNode<S>[]
622
+ toolBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
623
+ parentItemsNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
624
+ statusBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
625
+ afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
626
626
  [key: string]: any
627
627
  }
628
628
  ): VNode<S>
629
629
  ```
630
630
 
631
- - state : ステート
632
- - id : ユニークID (DOM ID)
633
- - currentKeys : カレント NavigatorItem までのパス
634
- - columns : NavigatorColumn の配列を返す関数
635
- - plugIn : プラグインの挿入
636
- - afterRender : レンダーフック
631
+ - state : ステート
632
+ - id : ユニークID (DOM ID)
633
+ - currentKeys : カレント NavigatorItem までのパス
634
+ - columns : NavigatorColumn の配列を返す関数
635
+ - plugIn : プラグインの挿入
636
+ - toolBarNode : `toolBar` レンダーフック
637
+ - parentItemsNode: `parentItems` レンダーフック
638
+ - statusBarNode : `statusBar` レンダーフック
639
+ - afterRender : 全体のレンダーフック
637
640
 
638
641
  localState
639
642
  - searchText: "" as string // 検索テキスト
@@ -645,39 +648,40 @@ localState
645
648
  vnode
646
649
  ```html
647
650
  <div id={id}>
648
-
649
- <div class="toolBar">
650
- <input type="text" />
651
- <button type="button">FILTER</button>
651
+ <div class="rapper">
652
+ <div class="toolBar">
653
+ <input type="text" />
654
+ <button type="button">FILTER</button>
655
+ </div>
656
+
657
+ <div class="parentItems">
658
+ <ol>
659
+ <li>parent</li>
660
+ </ol>
661
+ <button type="button">COPY</button>
662
+ </div>
663
+
664
+ <div class="items">
665
+ <table>
666
+ <thead>
667
+ <tr>
668
+ <th>ヘッダー</th>
669
+ <th class="sort">ソート付きヘッダー</th>
670
+ </tr>
671
+ </thead>
672
+ <tbody>
673
+ <tr>
674
+ <td class="file"><span>value</span></td>
675
+ <td class="directory"><span>value</span></td>
676
+ </tr>
677
+ </tbody>
678
+ </table>
679
+ </div>
680
+
681
+ <div class="statusBar">message</div>
652
682
  </div>
653
683
 
654
- <div class="parentItems">
655
- <ol>
656
- <li>parent</li>
657
- </ol>
658
- <button type="button">COPY</button>
659
- </div>
660
-
661
- <div class="items">
662
- <table>
663
- <thead>
664
- <tr>
665
- <th>ヘッダー</th>
666
- <th class="sort">ソート付きヘッダー</th>
667
- </tr>
668
- </thead>
669
- <tbody>
670
- <tr>
671
- <td class="file"><span>value</span></td>
672
- <td class="directory"><span>value</span></td>
673
- </tr>
674
- </tbody>
675
- </table>
676
- </div>
677
-
678
- <div class="statusBar">message</div>
679
-
680
- <!-- plugIn 必要な文だけ追加 -->
684
+ <!-- plugIn 必要な分だけ追加 -->
681
685
  <div id={plugInID}>
682
686
  </div>
683
687
  </div>
@@ -703,24 +707,31 @@ export interface SearchResult {
703
707
  ```ts
704
708
  export const NavigatorSearch = function <S> (
705
709
  props: {
706
- state : S
707
- id : string
708
- currentKeys : Keys_NavigatorItem
709
- searchResult : (item: NavigatorItem, depth: number) => VNode<S> | VNode<S>[]
710
- hitTest : (item: NavigatorItem) => boolean
711
- maxItemsCount : number
712
- afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
713
- [key: string]: any
710
+ state : S
711
+ id : string
712
+ currentKeys : Keys_NavigatorItem
713
+ searchResult : (item: NavigatorItem, depth: number) => VNode<S> | VNode<S>[]
714
+ hitTest : (item: NavigatorItem) => boolean
715
+ maxItemsCount : number
716
+ toolBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
717
+ parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
718
+ statusBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
719
+ afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
720
+ [key: string] : any
714
721
  }
715
722
  ): VNode<S>
716
723
  ```
717
724
 
718
- - state : ステート
719
- - id : ユニークID (DOM ID)
720
- - searchResult : カードとして表示する VNode
721
- - hitTest : 抽出条件
722
- - maxItemsCount: 最初に表示するカードの最大数
723
- - afterRender : レンダーフック
725
+ - state : ステート
726
+ - id : ユニークID (DOM ID)
727
+ - currentKeys : カレント NavigatorItem までのパス
728
+ - searchResult : カードとして表示する VNode
729
+ - hitTest : 抽出条件
730
+ - maxItemsCount : 最初に表示するカードの最大数
731
+ - toolBarNode : `toolBar` レンダーフック
732
+ - parentItemsNode: `parentItems` レンダーフック
733
+ - statusBarNode : `statusBar` レンダーフック
734
+ - afterRender : 全体のレンダーフック
724
735
 
725
736
  localState
726
737
  - maxItemsCount: props.maxItemsCount as number // カードの最大表示数
@@ -53,6 +53,9 @@ export declare const NavigatorFinder: <S>(props: {
53
53
  currentKeys: Keys_NavigatorItem;
54
54
  columns?: (directory: NavigatorItem | undefined) => NavigatorColumn[];
55
55
  plugIn?: (state: S, localState: Record<string, any>) => VNode<S>[];
56
+ toolBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
57
+ parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
58
+ statusBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
56
59
  afterRender?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
57
60
  [key: string]: any;
58
61
  }) => VNode<S>;
@@ -97,6 +100,9 @@ export declare const NavigatorSearch: <S>(props: {
97
100
  searchResult: (item: NavigatorItem, depth: number) => VNode<S> | VNode<S>[];
98
101
  hitTest: (item: NavigatorItem) => boolean;
99
102
  maxItemsCount: number;
103
+ toolBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
104
+ parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
105
+ statusBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
100
106
  afterRender?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
101
107
  [key: string]: any;
102
108
  }) => VNode<S>;
@@ -261,29 +261,41 @@ export const NavigatorFinder = function (props) {
261
261
  // ---------- ---------- ----------
262
262
  // VNode
263
263
  // ---------- ---------- ----------
264
- const vnode = div({
265
- ...deleteKeys(props, "state", "currentKeys", "columns", "plugIn", "afterRender")
266
- }, div({
264
+ // toolBarNode
265
+ const toolBarNode = div({
267
266
  class: "toolBar"
268
267
  }, input({
269
268
  type: "text",
270
269
  placeholder: "search keys",
271
270
  value: localState.searchText,
272
271
  oninput: action_inputSearchText
273
- }), SelectButton({
272
+ }), button({
273
+ type: "button",
274
+ title: "delete keys",
275
+ onclick: (state) => {
276
+ return setLocalState(state, id, {
277
+ searchText: ""
278
+ });
279
+ }
280
+ }, icon_trashBox), SelectButton({
274
281
  state: state,
275
282
  id: `${createLocalKey(id)}_filter`,
276
- keyNames: [createLocalKey(id), "selected"]
277
- }, "FILTER")), div({
283
+ keyNames: [createLocalKey(id), "selected"],
284
+ title: "filter"
285
+ }, icon_filter));
286
+ // parentItemsNode
287
+ const parentItemsNode = div({
278
288
  class: "parentItems"
279
289
  }, ol({}, parentItems.map(parent => li({
280
290
  key: parent.path,
281
291
  onclick: [action_parentClick, parent]
282
292
  }, parent.name))), button({
283
293
  type: "button",
284
- title: "現在のフォルダパスを、クリップボードにコピー",
294
+ title: "copy",
285
295
  onclick: action_copyFolderPath
286
- }, "COPY")), div({
296
+ }, icon_copy));
297
+ // itemsNode
298
+ const itemsNode = div({
287
299
  class: "items"
288
300
  }, table({}, thead({}, tr({}, columns.map(col => th({
289
301
  class: col.compare ? "sort" : "",
@@ -306,9 +318,15 @@ export const NavigatorFinder = function (props) {
306
318
  }, span({
307
319
  class: hitTest(t) ? "hit" : ""
308
320
  }, v));
309
- })))))),
310
- // statusBar
311
- div({ class: "statusBar" }, message),
321
+ }))))));
322
+ // statusBarNode
323
+ const statusBarNode = div({ class: "statusBar" }, message);
324
+ // vnode
325
+ const vnode = div({
326
+ ...deleteKeys(props, "state", "currentKeys", "columns", "plugIn", "toolBarNode", "parentItemsNode", "statusBarNode", "afterRender")
327
+ }, div({
328
+ class: "rapper"
329
+ }, props.toolBarNode ? props.toolBarNode(state, localState, toolBarNode) : toolBarNode, props.parentItemsNode ? props.parentItemsNode(state, localState, parentItemsNode) : parentItemsNode, itemsNode, props.statusBarNode ? props.statuBarNode(state, localState, statusBarNode) : statusBarNode),
312
330
  // plugIn
313
331
  plugIn
314
332
  ? plugIn(state, localState)
@@ -387,6 +405,39 @@ const icon_file = svg({
387
405
  strokeLinecap: "round",
388
406
  strokeLinejoin: "round"
389
407
  }, path({ d: "M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z" }), path({ d: "M14 2v6h6" }));
408
+ // icon_trashBox
409
+ const icon_trashBox = svg({
410
+ viewBox: "0 0 24 24",
411
+ width: 24,
412
+ height: 24,
413
+ fill: "none",
414
+ stroke: "currentColor",
415
+ strokeWidth: 2,
416
+ strokeLinecap: "round",
417
+ strokeLinejoin: "round"
418
+ }, path({ d: "M3 6h18" }), path({ d: "M8 6V4h8v2" }), path({ d: "M6 6l1 14h10l1-14" }), path({ d: "M10 11v6" }), path({ d: "M14 11v6" }));
419
+ // icon_filter
420
+ const icon_filter = svg({
421
+ viewBox: "0 0 24 24",
422
+ width: 24,
423
+ height: 24,
424
+ fill: "none",
425
+ stroke: "currentColor",
426
+ strokeWidth: 2,
427
+ strokeLinecap: "round",
428
+ strokeLinejoin: "round"
429
+ }, path({ d: "M3 5h18" }), path({ d: "M6 12h12" }), path({ d: "M10 19h4" }));
430
+ // icon_copy
431
+ const icon_copy = svg({
432
+ viewBox: "0 0 24 24",
433
+ width: 24,
434
+ height: 24,
435
+ fill: "none",
436
+ stroke: "currentColor",
437
+ strokeWidth: 2,
438
+ strokeLinecap: "round",
439
+ strokeLinejoin: "round"
440
+ }, path({ d: "M9 9h11v11H9z" }), path({ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }));
390
441
  // ---------- ---------- ---------- ---------- ----------
391
442
  // NavigatorSearch Component (NavigatorFinder plugIn)
392
443
  // ---------- ---------- ---------- ---------- ----------
@@ -516,54 +567,58 @@ export const NavigatorSearch = function (props) {
516
567
  // ---------- ---------- ----------
517
568
  // vnode
518
569
  // ---------- ---------- ----------
519
- const vnode = div({
520
- ...deleteKeys(props, "state", "currentKeys", "searchResult", "hitTest", "maxItemsCount", "afterRender")
521
- },
522
- // toolBar
523
- div({
570
+ const toolBarNode = div({
524
571
  class: "toolBar"
525
572
  },
526
573
  // sort
527
574
  button({
528
575
  type: "button",
576
+ title: "sort depth",
529
577
  onclick: [action_setSort, "depth"]
530
578
  }, icon_depth), button({
531
579
  type: "button",
580
+ title: "sort name",
532
581
  onclick: [action_setSort, "name"]
533
582
  }, icon_name),
534
583
  // filter
535
584
  button({
536
585
  type: "button",
537
586
  class: localState.isDirectory ? "" : "ignore",
587
+ title: "directory",
538
588
  onclick: (state) => setLocalState(state, id, {
539
589
  isDirectory: !localState.isDirectory
540
590
  })
541
591
  }, icon_directory), button({
542
592
  type: "button",
543
593
  class: localState.isFile ? "" : "ignore",
594
+ title: "file",
544
595
  onclick: (state) => setLocalState(state, id, {
545
596
  isFile: !localState.isFile
546
597
  })
547
- }, icon_file)),
548
- // parentItems
549
- div({
598
+ }, icon_file));
599
+ // parentItemsNode
600
+ const parentItemsNode = div({
550
601
  class: "parentItems"
551
602
  }, ol({}, parentItems.map(item => li({
552
603
  onclick: (state) => setValue(state, currentKeys, item)
553
- }, item.name)))),
554
- // items
555
- div({
604
+ }, item.name))));
605
+ // itemsNode
606
+ const itemsNode = div({
556
607
  class: "items",
557
608
  onscroll: action_itemsScroll
558
609
  }, ul({}, drawItems.map(item => li({
559
610
  class: "item",
560
611
  key: item.item.path,
561
612
  title: item.item.path
562
- }, searchResult(item.item, item.depth))))),
563
- // statusBar
564
- div({
613
+ }, searchResult(item.item, item.depth)))));
614
+ // statusBarNode
615
+ const statusBarNode = div({
565
616
  class: "statusBar"
566
- }, message));
617
+ }, message);
618
+ // vnode
619
+ const vnode = div({
620
+ ...deleteKeys(props, "state", "currentKeys", "searchResult", "hitTest", "maxItemsCount", "toolBarNode", "parentItemsNode", "statusBarNode", "afterRender")
621
+ }, props.toolBarNode ? props.toolBarNode(state, localState, toolBarNode) : toolBarNode, props.parentItemsNode ? props.parentItemsNode(state, localState, parentItemsNode) : parentItemsNode, itemsNode, props.statusBarNode ? props.statusBarNode(state, localState, statusBarNode) : statusBarNode);
567
622
  // ---------- ---------- ----------
568
623
  // afterRender
569
624
  // ---------- ---------- ----------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperapp-is",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "UI foundation library for Hyperapp by is4416",
5
5
  "license": "MIT",
6
6
  "type": "module",