|
2 | 2 | import type { Component } from 'svelte'; |
3 | 3 | import type { SVGAttributes } from 'svelte/elements'; |
4 | 4 |
|
5 | | - import MdiSegment from '~icons/mdi/segment'; |
6 | | - import MdiGridLarge from '~icons/mdi/grid-large'; |
7 | | - import MdiFormatListBulleted from '~icons/mdi/format-list-bulleted'; |
8 | | - import MdiRadioboxBlank from '~icons/mdi/radiobox-blank'; |
9 | | - import MdiCheckboxBlankOutline from '~icons/mdi/checkbox-blank-outline'; |
10 | | - import MdiCursorText from '~icons/mdi/cursor-text'; |
11 | | - import MdiHashtag from '~icons/mdi/hashtag'; |
12 | | - import MdiToggleSwitchOffOutline from '~icons/mdi/toggle-switch-off-outline'; |
13 | | - import MdiAttachFile from '~icons/mdi/attach-file'; |
14 | | - import MdiTag from '~icons/mdi/tag'; |
| 5 | + import MdiSegment from '~icons/mdi/segment'; |
| 6 | + import MdiGridLarge from '~icons/mdi/grid-large'; |
| 7 | + import MdiFormatListBulleted from '~icons/mdi/format-list-bulleted'; |
| 8 | + import MdiRadioboxBlank from '~icons/mdi/radiobox-blank'; |
| 9 | + import MdiCheckboxBlankOutline from '~icons/mdi/checkbox-blank-outline'; |
| 10 | + import MdiCursorText from '~icons/mdi/cursor-text'; |
| 11 | + import MdiHashtag from '~icons/mdi/hashtag'; |
| 12 | + import MdiToggleSwitchOffOutline from '~icons/mdi/toggle-switch-off-outline'; |
| 13 | + import MdiAttachFile from '~icons/mdi/attach-file'; |
| 14 | + import MdiTag from '~icons/mdi/tag'; |
15 | 15 |
|
16 | | - import MdiSetAnd from '~icons/mdi/set-and'; |
17 | | - import MdiSetOr from '~icons/mdi/set-or'; |
18 | | - import MdiSetXor from '~icons/mdi/set-xor'; |
19 | | - import MdiSetNot from '~icons/mdi/set-not'; |
20 | | - import MdiEqual from '~icons/mdi/equal'; |
21 | | - import MdiFormatListChecks from '~icons/mdi/format-list-checks'; |
22 | | - import MdiRegex from '~icons/mdi/regex'; |
23 | | - import MdiArrowExpandHorizontal from '~icons/mdi/arrow-expand-horizontal'; |
24 | | - import MdiArrowCollapseHorizontal from '~icons/mdi/arrow-collapse-horizontal'; |
25 | | - import MdiLessThan from '~icons/mdi/less-than'; |
26 | | - import MdiLessThanOrEqual from '~icons/mdi/less-than-or-equal'; |
27 | | - import MdiGreaterThan from '~icons/mdi/greater-than'; |
28 | | - import MdiGreaterThanOrEqual from '~icons/mdi/greater-than-or-equal'; |
29 | | - import MdiMultiplication from '~icons/mdi/multiplication'; |
30 | | - import MdiContain from '~icons/mdi/contain'; |
31 | | - import MdiMinusBox from '~icons/mdi/minus-box'; |
32 | | - import MdiPlusBox from '~icons/mdi/plus-box'; |
33 | | - import MdiVectorArrangeAbove from '~icons/mdi/vector-arrange-above'; |
34 | | - import MdiPageNextOutline from '~icons/mdi/page-next-outline'; |
35 | | - import MdiFileTree from '~icons/mdi/file-tree'; |
36 | | - import MdiArrowLeftRight from '~icons/mdi/arrow-left-right'; |
37 | | - import MdiFormatText from '~icons/mdi/format-text'; |
| 16 | + import MdiSetAnd from '~icons/mdi/set-and'; |
| 17 | + import MdiSetOr from '~icons/mdi/set-or'; |
| 18 | + import MdiSetXor from '~icons/mdi/set-xor'; |
| 19 | + import MdiSetNot from '~icons/mdi/set-not'; |
| 20 | + import MdiEqual from '~icons/mdi/equal'; |
| 21 | + import MdiFormatListChecks from '~icons/mdi/format-list-checks'; |
| 22 | + import MdiRegex from '~icons/mdi/regex'; |
| 23 | + import MdiArrowExpandHorizontal from '~icons/mdi/arrow-expand-horizontal'; |
| 24 | + import MdiArrowCollapseHorizontal from '~icons/mdi/arrow-collapse-horizontal'; |
| 25 | + import MdiLessThan from '~icons/mdi/less-than'; |
| 26 | + import MdiLessThanOrEqual from '~icons/mdi/less-than-or-equal'; |
| 27 | + import MdiGreaterThan from '~icons/mdi/greater-than'; |
| 28 | + import MdiGreaterThanOrEqual from '~icons/mdi/greater-than-or-equal'; |
| 29 | + import MdiMultiplication from '~icons/mdi/multiplication'; |
| 30 | + import MdiContain from '~icons/mdi/contain'; |
| 31 | + import MdiMinusBox from '~icons/mdi/minus-box'; |
| 32 | + import MdiPlusBox from '~icons/mdi/plus-box'; |
| 33 | + import MdiVectorArrangeAbove from '~icons/mdi/vector-arrange-above'; |
| 34 | + import MdiPageNextOutline from '~icons/mdi/page-next-outline'; |
| 35 | + import MdiFileTree from '~icons/mdi/file-tree'; |
| 36 | + import MdiArrowLeftRight from '~icons/mdi/arrow-left-right'; |
| 37 | + import MdiFormatText from '~icons/mdi/format-text'; |
38 | 38 |
|
39 | 39 | import { |
40 | 40 | createNode, |
|
52 | 52 | import NodeFactory from '../node-factory.svelte'; |
53 | 53 |
|
54 | 54 | const NODE_ICONS: Record<NodeType, Component<SVGAttributes<SVGSVGElement>> | null> = { |
55 | | - [NodeType.Object]: MdiSegment, |
56 | | - [NodeType.ObjectProperty]: null, |
57 | | - [NodeType.ObjectPropertyDependency]: null, |
58 | | - [NodeType.Predicate]: null, |
59 | | - [NodeType.Operator]: null, |
60 | | - [NodeType.Array]: MdiFormatListBulleted, |
61 | | - [NodeType.Grid]: MdiGridLarge, |
62 | | - [NodeType.Enum]: MdiRadioboxBlank, |
63 | | - [NodeType.MultiEnum]: MdiCheckboxBlankOutline, |
64 | | - [NodeType.EnumItem]: null, |
65 | | - [NodeType.String]: MdiCursorText, |
66 | | - [NodeType.Number]: MdiHashtag, |
67 | | - [NodeType.Boolean]: MdiToggleSwitchOffOutline, |
68 | | - [NodeType.File]: MdiAttachFile, |
69 | | - [NodeType.Tags]: MdiTag, |
70 | | - [NodeType.Range]: MdiArrowLeftRight, |
71 | | - }; |
| 55 | + [NodeType.Object]: MdiSegment, |
| 56 | + [NodeType.ObjectProperty]: null, |
| 57 | + [NodeType.ObjectPropertyDependency]: null, |
| 58 | + [NodeType.Predicate]: null, |
| 59 | + [NodeType.Operator]: null, |
| 60 | + [NodeType.Array]: MdiFormatListBulleted, |
| 61 | + [NodeType.Grid]: MdiGridLarge, |
| 62 | + [NodeType.Enum]: MdiRadioboxBlank, |
| 63 | + [NodeType.MultiEnum]: MdiCheckboxBlankOutline, |
| 64 | + [NodeType.EnumItem]: null, |
| 65 | + [NodeType.String]: MdiCursorText, |
| 66 | + [NodeType.Number]: MdiHashtag, |
| 67 | + [NodeType.Boolean]: MdiToggleSwitchOffOutline, |
| 68 | + [NodeType.File]: MdiAttachFile, |
| 69 | + [NodeType.Tags]: MdiTag, |
| 70 | + [NodeType.Range]: MdiArrowLeftRight |
| 71 | + }; |
72 | 72 |
|
73 | | - const OPERATOR_ICONS: Record<OperatorType, Component<SVGAttributes<SVGSVGElement>>> = { |
74 | | - [OperatorType.And]: MdiSetAnd, |
75 | | - [OperatorType.Or]: MdiSetOr, |
76 | | - [OperatorType.Xor]: MdiSetXor, |
77 | | - [OperatorType.Not]: MdiSetNot, |
78 | | - // Shared |
79 | | - [OperatorType.Eq]: MdiEqual, |
80 | | - [OperatorType.In]: MdiFormatListChecks, |
81 | | - // String |
82 | | - [OperatorType.Format]: MdiFormatText, |
83 | | - [OperatorType.Pattern]: MdiRegex, |
84 | | - [OperatorType.MinLength]: MdiArrowCollapseHorizontal, |
85 | | - [OperatorType.MaxLength]: MdiArrowExpandHorizontal, |
86 | | - // Number |
87 | | - [OperatorType.Less]: MdiLessThan, |
88 | | - [OperatorType.LessOrEq]: MdiLessThanOrEqual, |
89 | | - [OperatorType.Greater]: MdiGreaterThan, |
90 | | - [OperatorType.GreaterOrEq]: MdiGreaterThanOrEqual, |
91 | | - [OperatorType.MultipleOf]: MdiMultiplication, |
92 | | - // Array |
93 | | - [OperatorType.Contains]: MdiContain, |
94 | | - [OperatorType.MinItems]: MdiMinusBox, |
95 | | - [OperatorType.MaxItems]: MdiPlusBox, |
96 | | - [OperatorType.UniqueItems]: MdiVectorArrangeAbove, |
97 | | - // Object |
98 | | - [OperatorType.HasProperty]: MdiPageNextOutline, |
99 | | - [OperatorType.Property]: MdiFileTree, |
100 | | - } |
| 73 | + const OPERATOR_ICONS: Record<OperatorType, Component<SVGAttributes<SVGSVGElement>>> = { |
| 74 | + [OperatorType.And]: MdiSetAnd, |
| 75 | + [OperatorType.Or]: MdiSetOr, |
| 76 | + [OperatorType.Xor]: MdiSetXor, |
| 77 | + [OperatorType.Not]: MdiSetNot, |
| 78 | + // Shared |
| 79 | + [OperatorType.Eq]: MdiEqual, |
| 80 | + [OperatorType.In]: MdiFormatListChecks, |
| 81 | + // String |
| 82 | + [OperatorType.Format]: MdiFormatText, |
| 83 | + [OperatorType.Pattern]: MdiRegex, |
| 84 | + [OperatorType.MinLength]: MdiArrowCollapseHorizontal, |
| 85 | + [OperatorType.MaxLength]: MdiArrowExpandHorizontal, |
| 86 | + // Number |
| 87 | + [OperatorType.Less]: MdiLessThan, |
| 88 | + [OperatorType.LessOrEq]: MdiLessThanOrEqual, |
| 89 | + [OperatorType.Greater]: MdiGreaterThan, |
| 90 | + [OperatorType.GreaterOrEq]: MdiGreaterThanOrEqual, |
| 91 | + [OperatorType.MultipleOf]: MdiMultiplication, |
| 92 | + // Array |
| 93 | + [OperatorType.Contains]: MdiContain, |
| 94 | + [OperatorType.MinItems]: MdiMinusBox, |
| 95 | + [OperatorType.MaxItems]: MdiPlusBox, |
| 96 | + [OperatorType.UniqueItems]: MdiVectorArrangeAbove, |
| 97 | + // Object |
| 98 | + [OperatorType.HasProperty]: MdiPageNextOutline, |
| 99 | + [OperatorType.Property]: MdiFileTree |
| 100 | + }; |
101 | 101 |
|
102 | 102 | const ctx = getBuilderContext(); |
103 | 103 | const entries: { |
|
132 | 132 | <NodeFactory createNode={factory} {title}> |
133 | 133 | {#snippet icon()} |
134 | 134 | {@const Icon = operatorType ? OPERATOR_ICONS[operatorType] : NODE_ICONS[nodeType]} |
135 | | - <Icon /> |
| 135 | + <Icon /> |
136 | 136 | {/snippet} |
137 | 137 | </NodeFactory> |
138 | 138 | {/each} |
| 139 | + <p class="pt-2 text-sm text-muted-foreground"> |
| 140 | + The set of available fields and their corresponding widgets depends on the selected theme. |
| 141 | + </p> |
139 | 142 | </div> |
0 commit comments