native-document 1.0.168 → 1.0.172

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +99 -4
  2. package/components.js +3 -1
  3. package/dist/native-document.components.min.js +197 -171
  4. package/dist/native-document.dev.js +92 -75
  5. package/dist/native-document.dev.js.map +1 -1
  6. package/dist/native-document.min.js +1 -1
  7. package/docs/components/icons.md +321 -0
  8. package/docs/vitepress-conventions.md +2 -2
  9. package/package.json +11 -4
  10. package/src/components/BaseComponent.js +43 -1
  11. package/src/components/accordion/Accordion.js +1 -0
  12. package/src/components/accordion/AccordionItem.js +1 -0
  13. package/src/components/alert/Alert.js +4 -0
  14. package/src/components/avatar/Avatar.js +1 -0
  15. package/src/components/avatar/AvatarGroup.js +1 -0
  16. package/src/components/badge/Badge.js +1 -0
  17. package/src/components/breadcrumb/BreadCrumb.js +4 -0
  18. package/src/components/button/Button.js +1 -0
  19. package/src/components/card/Card.js +1 -0
  20. package/src/components/context-menu/ContextMenu.js +2 -0
  21. package/src/components/context-menu/ContextMenuGroup.js +2 -0
  22. package/src/components/context-menu/ContextMenuItem.js +2 -0
  23. package/src/components/divider/Divider.js +2 -0
  24. package/src/components/dropdown/Dropdown.js +1 -0
  25. package/src/components/dropdown/DropdownDivider.js +1 -0
  26. package/src/components/dropdown/DropdownGroup.js +1 -0
  27. package/src/components/dropdown/DropdownItem.js +1 -0
  28. package/src/components/dropdown/DropdownTrigger.js +1 -0
  29. package/src/components/form/FormControl.js +1 -0
  30. package/src/components/form/field/Field.js +1 -0
  31. package/src/components/form/field/types/FileField.js +3 -3
  32. package/src/components/form/field/types/StringField.js +1 -1
  33. package/src/components/icon/Icon.js +108 -0
  34. package/src/components/icon/icon-getters.js +142 -0
  35. package/src/components/icon/icons.js +171 -0
  36. package/src/components/icon/index.js +17 -0
  37. package/src/components/icon/types/Icon.d.ts +191 -0
  38. package/src/components/index.d.ts +6 -1
  39. package/src/components/list/ListItem.js +1 -0
  40. package/src/components/list/types/List.d.ts +45 -32
  41. package/src/components/list/types/ListDivider.ts +16 -0
  42. package/src/components/list/types/ListGroup.d.ts +51 -29
  43. package/src/components/list/types/ListItem.d.ts +20 -21
  44. package/src/components/menu/Menu.js +3 -0
  45. package/src/components/menu/MenuDivider.js +1 -0
  46. package/src/components/menu/MenuGroup.js +1 -0
  47. package/src/components/menu/MenuItem.js +1 -0
  48. package/src/components/menu/MenuLink.js +1 -0
  49. package/src/components/modal/Modal.js +4 -0
  50. package/src/components/pagination/Pagination.js +1 -0
  51. package/src/components/popover/Popover.js +1 -0
  52. package/src/components/popover/PopoverFooter.js +1 -0
  53. package/src/components/popover/PopoverHeader.js +1 -0
  54. package/src/components/progress/Progress.js +5 -0
  55. package/src/components/skeleton/Skeleton.js +4 -0
  56. package/src/components/slider/Slider.js +1 -0
  57. package/src/components/spacer/Spacer.js +1 -0
  58. package/src/components/spinner/Spinner.js +1 -0
  59. package/src/components/splitter/Splitter.js +1 -0
  60. package/src/components/splitter/SplitterGutter.js +6 -0
  61. package/src/components/splitter/SplitterPanel.js +1 -0
  62. package/src/components/stacks/AbsoluteStack.js +1 -0
  63. package/src/components/stacks/FixedStack.js +1 -0
  64. package/src/components/stacks/HStack.js +1 -0
  65. package/src/components/stacks/PositionStack.js +1 -0
  66. package/src/components/stacks/RelativeStack.js +1 -0
  67. package/src/components/stacks/Stack.js +1 -0
  68. package/src/components/stacks/VStack.js +1 -0
  69. package/src/components/stepper/Stepper.js +1 -0
  70. package/src/components/stepper/StepperStep.js +1 -0
  71. package/src/components/switch/Switch.js +1 -0
  72. package/src/components/table/DataTable.js +1 -0
  73. package/src/components/table/SimpleTable.js +1 -0
  74. package/src/components/tabs/Tabs.js +1 -0
  75. package/src/components/toast/Toast.js +1 -0
  76. package/src/components/tooltip/Tooltip.js +1 -0
  77. package/src/core/data/MemoryManager.js +6 -1
  78. package/src/core/data/ObservableItem.js +28 -10
  79. package/src/core/elements/anchor/anchor.js +4 -3
  80. package/src/core/elements/anchor/one-child-anchor-overwriting.js +4 -4
  81. package/src/core/elements/content-formatter.js +35 -2
  82. package/src/core/elements/control/for-each-array-cache.js +59 -0
  83. package/src/core/elements/control/for-each-array.js +15 -23
  84. package/src/core/elements/form.js +1 -1
  85. package/src/core/elements/img.js +1 -1
  86. package/src/core/elements/medias.js +2 -2
  87. package/src/core/elements/meta-data.js +1 -1
  88. package/src/core/wrappers/AttributesWrapper.js +44 -29
  89. package/src/core/wrappers/ElementCreator.js +38 -22
  90. package/src/core/wrappers/HtmlElementWrapper.js +33 -9
  91. package/src/core/wrappers/NDElement.js +35 -9
  92. package/src/core/wrappers/NdPrototype.js +31 -39
  93. package/src/core/wrappers/constants.js +12 -12
  94. package/src/core/wrappers/prototypes/attributes-extensions.js +24 -24
  95. package/src/core/wrappers/prototypes/nd-element-extensions.js +128 -65
  96. package/src/ui/components/accordion/AccordionItemRender.js +29 -7
  97. package/src/ui/components/alert/AlertRender.js +6 -0
  98. package/src/ui/components/breadcrumb/BreadcrumbRender.js +9 -1
  99. package/src/ui/components/button/ButtonRender.js +3 -0
  100. package/src/ui/components/contextmenu/ContextmenuRender.js +2 -0
  101. package/src/ui/components/dropdown/DropdownRender.js +3 -0
  102. package/src/ui/components/dropdown/item/DropdownItemRender.js +6 -1
  103. package/src/ui/components/form/FieldCollectionRender.js +4 -0
  104. package/src/ui/components/form/fields/CheckboxFieldRender.js +4 -0
  105. package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +4 -0
  106. package/src/ui/components/form/fields/RadioFieldRender.js +4 -0
  107. package/src/ui/components/form/fields/RangeFieldRender.js +4 -0
  108. package/src/ui/components/form/fields/SelectFieldRender.js +5 -0
  109. package/src/ui/components/form/fields/SliderFieldRender.js +3 -0
  110. package/src/ui/components/icon/material/MaterialIconRender.js +71 -0
  111. package/src/ui/components/icon/material/material.css +15 -0
  112. package/src/ui/components/icon/material/material.map.js +170 -0
  113. package/src/ui/components/icon/phosphor/PhosphorIconRender.js +71 -0
  114. package/src/ui/components/icon/phosphor/phosphor.css +17 -0
  115. package/src/ui/components/icon/phosphor/phosphor.map.js +165 -0
  116. package/src/ui/components/icon/tabler/TablerIconRender.js +58 -0
  117. package/src/ui/components/icon/tabler/tabler.css +14 -0
  118. package/src/ui/components/icon/tabler/tabler.map.js +165 -0
  119. package/src/ui/components/list/item/ListItemRender.js +4 -0
  120. package/src/ui/components/menu/MenuItemRender.js +8 -0
  121. package/src/ui/components/menu/MenuLinkRender.js +11 -0
  122. package/src/ui/components/menu/MenuRender.js +5 -0
  123. package/src/ui/components/menu/helpers.js +2 -1
  124. package/src/ui/components/modal/ModalRender.js +8 -2
  125. package/src/ui/components/progress/ProgressRender.js +9 -0
  126. package/src/ui/components/skeleton/SkeletonRender.js +2 -0
  127. package/src/ui/components/spinner/SpinnerRender.js +3 -0
  128. package/src/ui/components/splitter/SplitterGutterRender.js +4 -0
  129. package/src/ui/components/splitter/SplitterPanelRender.js +4 -0
  130. package/src/ui/components/splitter/SplitterRender.js +2 -0
  131. package/src/ui/components/stepper/StepperRender.js +2 -1
  132. package/src/ui/components/stepper/StepperStepRender.js +8 -1
  133. package/src/ui/components/switch/SwitchRender.js +3 -0
  134. package/src/ui/components/table/data-table/DataTableRender.js +4 -0
  135. package/src/ui/components/table/simple-table/SimpleTableRender.js +2 -0
  136. package/src/ui/components/toast/ToastRender.js +4 -0
  137. package/src/ui/index.js +5 -0
  138. package/src/ui/utils/aria.js +19 -0
  139. package/tests/integration/ui/attributes-wrapper.test.js +177 -0
  140. package/tests/integration/ui/for-each-array.test.js +167 -0
  141. package/tests/integration/ui/lifecycle.test.js +146 -0
  142. package/tests/integration/ui/show-if.test.js +168 -0
  143. package/tests/unit/core/observable-array.test.js +404 -0
  144. package/tests/unit/core/observable-item.test.js +428 -0
  145. package/tests/unit/core/observable-object.test.js +239 -0
  146. package/tests/unit/core/observable-resource.test.js +323 -0
  147. package/tests/unit/core/store.test.js +347 -0
  148. package/tests/unit/router/route-matching.test.js +169 -0
  149. package/tests/unit/router/router-guards.test.js +189 -0
  150. package/tests/unit/utils/cache.test.js +120 -0
  151. package/tests/unit/utils/filters.test.js +394 -0
  152. package/types/elements.d.ts +5 -0
  153. package/vitest.config.js +15 -0
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Google Material Icons — ligature names.
3
+ * The icon name IS the ligature text content of the element.
4
+ * Names use snake_case as defined by Google.
5
+ */
6
+ export default {
7
+ // Navigation
8
+ arrowLeft: 'arrow_back',
9
+ arrowRight: 'arrow_forward',
10
+ arrowUp: 'arrow_upward',
11
+ arrowDown: 'arrow_downward',
12
+ chevronLeft: 'chevron_left',
13
+ chevronRight: 'chevron_right',
14
+ chevronUp: 'expand_less',
15
+ chevronDown: 'expand_more',
16
+ home: 'home',
17
+ menu: 'menu',
18
+ close: 'close',
19
+ back: 'arrow_back',
20
+ forward: 'arrow_forward',
21
+ expand: 'open_in_full',
22
+ collapse: 'close_fullscreen',
23
+ fullscreen: 'fullscreen',
24
+ fullscreenExit: 'fullscreen_exit',
25
+
26
+ // Actions
27
+ search: 'search',
28
+ filter: 'filter_list',
29
+ sort: 'sort',
30
+ edit: 'edit',
31
+ delete: 'delete',
32
+ add: 'add',
33
+ remove: 'remove',
34
+ save: 'save',
35
+ copy: 'content_copy',
36
+ download: 'download',
37
+ upload: 'upload',
38
+ share: 'share',
39
+ refresh: 'refresh',
40
+ more: 'more_horiz',
41
+ settings: 'settings',
42
+ drag: 'drag_indicator',
43
+ resize: 'open_with',
44
+ undo: 'undo',
45
+ redo: 'redo',
46
+ scan: 'qr_code_scanner',
47
+ print: 'print',
48
+ import: 'file_upload',
49
+ export: 'file_download',
50
+
51
+ // Feedback
52
+ check: 'check',
53
+ checkCircle: 'check_circle',
54
+ error: 'error',
55
+ warning: 'warning',
56
+ info: 'info',
57
+ help: 'help',
58
+ loading: 'sync',
59
+ success: 'task_alt',
60
+
61
+ // User
62
+ user: 'person',
63
+ userCircle: 'account_circle',
64
+ users: 'group',
65
+ lock: 'lock',
66
+ unlock: 'lock_open',
67
+ eye: 'visibility',
68
+ eyeOff: 'visibility_off',
69
+ bell: 'notifications',
70
+ notification: 'notification_important',
71
+
72
+ // Files & Media
73
+ file: 'insert_drive_file',
74
+ folder: 'folder',
75
+ image: 'image',
76
+ document: 'description',
77
+ attachment: 'attach_file',
78
+ link: 'link',
79
+ externalLink: 'open_in_new',
80
+ play: 'play_arrow',
81
+ pause: 'pause',
82
+ stop: 'stop',
83
+ mute: 'volume_off',
84
+ sound: 'volume_up',
85
+ video: 'videocam',
86
+ camera: 'camera_alt',
87
+
88
+ // Interface
89
+ grid: 'grid_view',
90
+ list: 'list',
91
+ calendar: 'calendar_today',
92
+ clock: 'access_time',
93
+ tag: 'label',
94
+ tags: 'label',
95
+ qrCode: 'qr_code',
96
+ barcode: 'barcode_reader',
97
+
98
+ // Text editing
99
+ bold: 'format_bold',
100
+ italic: 'format_italic',
101
+ underline: 'format_underlined',
102
+ strikethrough: 'strikethrough_s',
103
+ alignLeft: 'format_align_left',
104
+ alignCenter: 'format_align_center',
105
+ alignRight: 'format_align_right',
106
+ alignJustify: 'format_align_justify',
107
+ orderedList: 'format_list_numbered',
108
+ unorderedList: 'format_list_bulleted',
109
+ indent: 'format_indent_increase',
110
+ outdent: 'format_indent_decrease',
111
+ scissors: 'content_cut',
112
+ fontColor: 'format_color_text',
113
+ highlight: 'highlight',
114
+
115
+ // Data & charts
116
+ barChart: 'bar_chart',
117
+ lineChart: 'show_chart',
118
+ pieChart: 'pie_chart',
119
+ areaChart: 'area_chart',
120
+ table: 'table_chart',
121
+ database: 'storage',
122
+
123
+ // Commerce & finance
124
+ shoppingCart: 'shopping_cart',
125
+ creditCard: 'credit_card',
126
+ wallet: 'account_balance_wallet',
127
+ bank: 'account_balance',
128
+ gift: 'card_giftcard',
129
+ percentage: 'percent',
130
+ dollar: 'attach_money',
131
+ euro: 'euro',
132
+
133
+ // Communication
134
+ mail: 'mail',
135
+ message: 'message',
136
+ comment: 'comment',
137
+ phone: 'phone',
138
+
139
+ // System & dev
140
+ cloud: 'cloud',
141
+ cloudUpload: 'cloud_upload',
142
+ cloudDownload: 'cloud_download',
143
+ api: 'api',
144
+ code: 'code',
145
+ bug: 'bug_report',
146
+ tool: 'build',
147
+ robot: 'smart_toy',
148
+
149
+ // Location
150
+ map: 'map',
151
+ compass: 'explore',
152
+ global: 'language',
153
+ location: 'location_on',
154
+
155
+ // Shapes & objects
156
+ star: 'star',
157
+ heart: 'favorite',
158
+ flag: 'flag',
159
+ trophy: 'emoji_events',
160
+ medal: 'military_tech',
161
+ rocket: 'rocket_launch',
162
+ fire: 'local_fire_department',
163
+ thunder: 'bolt',
164
+ smile: 'sentiment_satisfied',
165
+ frown: 'sentiment_dissatisfied',
166
+ like: 'thumb_up',
167
+ dislike: 'thumb_down',
168
+ safety: 'verified_user',
169
+ key: 'key',
170
+ };
@@ -0,0 +1,71 @@
1
+ import './phosphor.css';
2
+ import MAP from './phosphor.map.js';
3
+ import { Span } from '../../../../core/elements';
4
+
5
+ const SIZES = {
6
+ small: 16,
7
+ medium: 24,
8
+ large: 32,
9
+ extraLarge: 48,
10
+ };
11
+
12
+ // Variant -> CSS weight class
13
+ // regular uses 'ph' (no suffix), others use 'ph-{variant}'
14
+ const VARIANT_CLASS = {
15
+ thin: 'ph-thin',
16
+ light: 'ph-light',
17
+ regular: 'ph',
18
+ bold: 'ph-bold',
19
+ fill: 'ph-fill',
20
+ duotone: 'ph-duotone',
21
+ };
22
+
23
+ /**
24
+ * Renders a Phosphor icon as a <span> element using CSS webfont classes.
25
+ *
26
+ * Variants: thin, light, regular (default), bold, fill, duotone
27
+ * Each variant requires its own CSS - see phosphor.css.
28
+ *
29
+ * @param {object} $desc
30
+ * @param {string} $desc.name
31
+ * @param {'thin'|'light'|'regular'|'bold'|'fill'|'duotone'|Observable<string>|null} $desc.variant
32
+ * @param {'small'|'medium'|'large'|'extraLarge'|number|Observable<string|number>|null} $desc.size
33
+ * @param {string|Observable<string>|null} $desc.color
34
+ * @returns {HTMLElement}
35
+ */
36
+ export default function PhosphorIconRender($desc) {
37
+ const phosphorName = MAP[$desc.name] ?? $desc.name;
38
+ const style = {};
39
+
40
+ let className;
41
+
42
+ if($desc.variant?.__$Observable) {
43
+ className = $desc.variant.transform((variant) => {
44
+ const weightClass = VARIANT_CLASS[variant] ?? 'ph';
45
+ return `${weightClass} ph-${phosphorName}`;
46
+ });
47
+ } else {
48
+ const weightClass = VARIANT_CLASS[$desc.variant] ?? 'ph';
49
+ className = `${weightClass} ph-${phosphorName}`;
50
+ }
51
+
52
+ if($desc.size?.__$Observable) {
53
+ style.fontSize = $desc.size.transform((size) => {
54
+ const px = typeof size === 'number' ? size : (SIZES[size] ?? SIZES.medium);
55
+ return `${px}px`;
56
+ });
57
+ } else {
58
+ const px = typeof $desc.size === 'number' ? $desc.size : (SIZES[$desc.size] ?? SIZES.medium);
59
+ style.fontSize = `${px}px`;
60
+ }
61
+
62
+ if($desc.color) {
63
+ style.color = $desc.color;
64
+ }
65
+
66
+ return Span({
67
+ 'aria-hidden': 'true',
68
+ class: className,
69
+ style,
70
+ });
71
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Phosphor Icons webfont
3
+ * Install : npm install @phosphor-icons/web
4
+ *
5
+ * Each variant requires its own CSS file.
6
+ * Import only the variants you need to keep bundle size minimal.
7
+ */
8
+ /*@import '@phosphor-icons/web/src/regular/style.css';*/
9
+
10
+ /*
11
+ * Uncomment the variants you need:
12
+ */
13
+ /* @import '@phosphor-icons/web/src/thin/style.css'; */
14
+ /* @import '@phosphor-icons/web/src/light/style.css'; */
15
+ /* @import '@phosphor-icons/web/src/bold/style.css'; */
16
+ /* @import '@phosphor-icons/web/src/fill/style.css'; */
17
+ /* @import '@phosphor-icons/web/src/duotone/style.css'; */
@@ -0,0 +1,165 @@
1
+ export default {
2
+ // Navigation
3
+ arrowLeft: 'arrow-left',
4
+ arrowRight: 'arrow-right',
5
+ arrowUp: 'arrow-up',
6
+ arrowDown: 'arrow-down',
7
+ chevronLeft: 'caret-left',
8
+ chevronRight: 'caret-right',
9
+ chevronUp: 'caret-up',
10
+ chevronDown: 'caret-down',
11
+ home: 'house',
12
+ menu: 'list',
13
+ close: 'x',
14
+ back: 'arrow-left',
15
+ forward: 'arrow-right',
16
+ expand: 'arrows-out',
17
+ collapse: 'arrows-in',
18
+ fullscreen: 'arrows-out-simple',
19
+ fullscreenExit: 'arrows-in-simple',
20
+
21
+ // Actions
22
+ search: 'magnifying-glass',
23
+ filter: 'funnel',
24
+ sort: 'arrows-down-up',
25
+ edit: 'pencil-simple',
26
+ delete: 'trash',
27
+ add: 'plus',
28
+ remove: 'minus',
29
+ save: 'floppy-disk',
30
+ copy: 'copy',
31
+ download: 'download-simple',
32
+ upload: 'upload-simple',
33
+ share: 'share-network',
34
+ refresh: 'arrows-clockwise',
35
+ more: 'dots-three',
36
+ settings: 'gear-six',
37
+ drag: 'dots-six-vertical',
38
+ resize: 'corners-out',
39
+ undo: 'arrow-counter-clockwise',
40
+ redo: 'arrow-clockwise',
41
+ scan: 'scan',
42
+ print: 'printer',
43
+ import: 'upload',
44
+ export: 'export',
45
+
46
+ // Feedback
47
+ check: 'check',
48
+ checkCircle: 'check-circle',
49
+ error: 'x-circle',
50
+ warning: 'warning',
51
+ info: 'info',
52
+ help: 'question',
53
+ loading: 'circle-notch',
54
+ success: 'check-circle',
55
+
56
+ // User
57
+ user: 'user',
58
+ userCircle: 'user-circle',
59
+ users: 'users',
60
+ lock: 'lock',
61
+ unlock: 'lock-open',
62
+ eye: 'eye',
63
+ eyeOff: 'eye-slash',
64
+ bell: 'bell',
65
+ notification: 'bell-ringing',
66
+
67
+ // Files & Media
68
+ file: 'file',
69
+ folder: 'folder',
70
+ image: 'image',
71
+ document: 'file-text',
72
+ attachment: 'paperclip',
73
+ link: 'link',
74
+ externalLink: 'arrow-square-out',
75
+ play: 'play',
76
+ pause: 'pause',
77
+ stop: 'stop',
78
+ mute: 'speaker-slash',
79
+ sound: 'speaker-high',
80
+ video: 'video',
81
+ camera: 'camera',
82
+
83
+ // Interface
84
+ grid: 'squares-four',
85
+ list: 'list',
86
+ calendar: 'calendar',
87
+ clock: 'clock',
88
+ tag: 'tag',
89
+ tags: 'tag',
90
+ qrCode: 'qr-code',
91
+ barcode: 'barcode',
92
+
93
+ // Text editing
94
+ bold: 'text-b',
95
+ italic: 'text-italic',
96
+ underline: 'text-underline',
97
+ strikethrough: 'text-strikethrough',
98
+ alignLeft: 'text-align-left',
99
+ alignCenter: 'text-align-center',
100
+ alignRight: 'text-align-right',
101
+ alignJustify: 'text-align-justify',
102
+ orderedList: 'list-numbers',
103
+ unorderedList: 'list-bullets',
104
+ indent: 'text-indent',
105
+ outdent: 'text-outdent',
106
+ scissors: 'scissors',
107
+ fontColor: 'text-aa',
108
+ highlight: 'highlighter-circle',
109
+
110
+ // Data & charts
111
+ barChart: 'chart-bar',
112
+ lineChart: 'chart-line',
113
+ pieChart: 'chart-pie',
114
+ areaChart: 'chart-line-up',
115
+ table: 'table',
116
+ database: 'database',
117
+
118
+ // Commerce & finance
119
+ shoppingCart: 'shopping-cart',
120
+ creditCard: 'credit-card',
121
+ wallet: 'wallet',
122
+ bank: 'bank',
123
+ gift: 'gift',
124
+ percentage: 'percent',
125
+ dollar: 'currency-dollar',
126
+ euro: 'currency-eur',
127
+
128
+ // Communication
129
+ mail: 'envelope',
130
+ message: 'chat-text',
131
+ comment: 'chat',
132
+ phone: 'phone',
133
+
134
+ // System & dev
135
+ cloud: 'cloud',
136
+ cloudUpload: 'cloud-arrow-up',
137
+ cloudDownload: 'cloud-arrow-down',
138
+ api: 'plugs',
139
+ code: 'code',
140
+ bug: 'bug',
141
+ tool: 'wrench',
142
+ robot: 'robot',
143
+
144
+ // Location
145
+ map: 'map-trifold',
146
+ compass: 'compass',
147
+ global: 'globe',
148
+ location: 'map-pin',
149
+
150
+ // Shapes & objects
151
+ star: 'star',
152
+ heart: 'heart',
153
+ flag: 'flag',
154
+ trophy: 'trophy',
155
+ medal: 'medal',
156
+ rocket: 'rocket',
157
+ fire: 'fire',
158
+ thunder: 'lightning',
159
+ smile: 'smiley',
160
+ frown: 'smiley-melting',
161
+ like: 'thumbs-up',
162
+ dislike: 'thumbs-down',
163
+ safety: 'shield-check',
164
+ key: 'key',
165
+ };
@@ -0,0 +1,58 @@
1
+ import MAP from './tabler.map.js';
2
+ import {Italic, Span} from '../../../../core/elements';
3
+
4
+ const SIZES = {
5
+ small: 16,
6
+ medium: 24,
7
+ large: 32,
8
+ extraLarge: 48,
9
+ };
10
+
11
+ import './tabler.css';
12
+
13
+ /**
14
+ * Renders a Tabler icon as an <i> element using CSS webfont classes.
15
+ *
16
+ * Variants:
17
+ * - outline (default) : ti ti-{name} requires tabler-icons.css
18
+ * - fill : ti ti-{name}-filled requires tabler-icons-filled.css
19
+ *
20
+ * @param {object} $desc
21
+ * @param {string} $desc.name
22
+ * @param {'outline'|'fill'|null} $desc.variant
23
+ * @param {'small'|'medium'|'large'|'extraLarge'|number|null} $desc.size
24
+ * @param {string|null} $desc.color
25
+ * @returns {HTMLElement}
26
+ */
27
+ export default function TablerIconRender($desc) {
28
+ const tablerName = MAP[$desc.name] ?? $desc.name;
29
+ const style = {};
30
+
31
+ let className = '';
32
+ if($desc.variant?.__$Observable) {
33
+ className = $desc.variant.format((variant) => {
34
+ if(variant === 'fill') {
35
+ return `ti ti-${tablerName}-filled`;
36
+ }
37
+ return `ti ti-${tablerName}`;
38
+ });
39
+ } else {
40
+ className = ($desc.variant === 'fill') ? `ti ti-${tablerName}-filled` : `ti ti-${tablerName}`;
41
+ }
42
+
43
+ let px;
44
+
45
+ style.fontSize = $desc.size?.__$Observable
46
+ ? $desc.size.transform((size) => `${typeof size === 'number' ? size : (SIZES[size] ?? SIZES.medium)}px`)
47
+ : `${typeof $desc.size === 'number' ? $desc.size : (SIZES[$desc.size] ?? SIZES.medium)}px`;
48
+
49
+ if($desc.color) {
50
+ style.color = $desc.color;
51
+ }
52
+
53
+ return Italic({
54
+ 'aria-hidden': 'true',
55
+ style,
56
+ class: className,
57
+ });
58
+ }
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Tabler Icons webfont
3
+ * Outline : @tabler/icons-webfont/tabler-icons.css
4
+ * Filled : @tabler/icons-webfont/tabler-icons-filled.css
5
+ *
6
+ * Install : npm install @tabler/icons-webfont
7
+ */
8
+ /*@import '@tabler/icons-webfont/tabler-icons.css';*/
9
+
10
+ /*
11
+ * Uncomment to enable filled variant (ti ti-{name}-filled)
12
+ * Note: filled and outline use separate font files
13
+ */
14
+ /* @import '@tabler/icons-webfont/tabler-icons-filled.css'; */
@@ -0,0 +1,165 @@
1
+ export default {
2
+ // Navigation
3
+ arrowLeft: 'arrow-left',
4
+ arrowRight: 'arrow-right',
5
+ arrowUp: 'arrow-up',
6
+ arrowDown: 'arrow-down',
7
+ chevronLeft: 'chevron-left',
8
+ chevronRight: 'chevron-right',
9
+ chevronUp: 'chevron-up',
10
+ chevronDown: 'chevron-down',
11
+ home: 'home',
12
+ menu: 'menu-2',
13
+ close: 'x',
14
+ back: 'arrow-back',
15
+ forward: 'arrow-forward',
16
+ expand: 'arrows-maximize',
17
+ collapse: 'arrows-minimize',
18
+ fullscreen: 'maximize',
19
+ fullscreenExit: 'minimize',
20
+
21
+ // Actions
22
+ search: 'search',
23
+ filter: 'filter',
24
+ sort: 'arrows-sort',
25
+ edit: 'pencil',
26
+ delete: 'trash',
27
+ add: 'plus',
28
+ remove: 'minus',
29
+ save: 'device-floppy',
30
+ copy: 'copy',
31
+ download: 'download',
32
+ upload: 'upload',
33
+ share: 'share',
34
+ refresh: 'refresh',
35
+ more: 'dots',
36
+ settings: 'settings',
37
+ drag: 'grip-horizontal',
38
+ resize: 'resize',
39
+ undo: 'arrow-back-up',
40
+ redo: 'arrow-forward-up',
41
+ scan: 'scan',
42
+ print: 'printer',
43
+ import: 'file-import',
44
+ export: 'file-export',
45
+
46
+ // Feedback
47
+ check: 'check',
48
+ checkCircle: 'circle-check',
49
+ error: 'circle-x',
50
+ warning: 'alert-triangle',
51
+ info: 'info-circle',
52
+ help: 'help-circle',
53
+ loading: 'loader-2',
54
+ success: 'circle-check',
55
+
56
+ // User
57
+ user: 'user',
58
+ userCircle: 'user-circle',
59
+ users: 'users',
60
+ lock: 'lock',
61
+ unlock: 'lock-open',
62
+ eye: 'eye',
63
+ eyeOff: 'eye-off',
64
+ bell: 'bell',
65
+ notification: 'bell-ringing',
66
+
67
+ // Files & Media
68
+ file: 'file',
69
+ folder: 'folder',
70
+ image: 'photo',
71
+ document: 'file-text',
72
+ attachment: 'paperclip',
73
+ link: 'link',
74
+ externalLink: 'external-link',
75
+ play: 'player-play',
76
+ pause: 'player-pause',
77
+ stop: 'player-stop',
78
+ mute: 'volume-off',
79
+ sound: 'volume',
80
+ video: 'video',
81
+ camera: 'camera',
82
+
83
+ // Interface
84
+ grid: 'layout-grid',
85
+ list: 'list',
86
+ calendar: 'calendar',
87
+ clock: 'clock',
88
+ tag: 'tag',
89
+ tags: 'tags',
90
+ qrCode: 'qrcode',
91
+ barcode: 'barcode',
92
+
93
+ // Text editing
94
+ bold: 'bold',
95
+ italic: 'italic',
96
+ underline: 'underline',
97
+ strikethrough: 'strikethrough',
98
+ alignLeft: 'align-left',
99
+ alignCenter: 'align-center',
100
+ alignRight: 'align-right',
101
+ alignJustify: 'align-justified',
102
+ orderedList: 'list-numbers',
103
+ unorderedList: 'list',
104
+ indent: 'indent-increase',
105
+ outdent: 'indent-decrease',
106
+ scissors: 'scissors',
107
+ fontColor: 'letter-case',
108
+ highlight: 'highlight',
109
+
110
+ // Data & charts
111
+ barChart: 'chart-bar',
112
+ lineChart: 'chart-line',
113
+ pieChart: 'chart-pie',
114
+ areaChart: 'chart-area',
115
+ table: 'table',
116
+ database: 'database',
117
+
118
+ // Commerce & finance
119
+ shoppingCart: 'shopping-cart',
120
+ creditCard: 'credit-card',
121
+ wallet: 'wallet',
122
+ bank: 'building-bank',
123
+ gift: 'gift',
124
+ percentage: 'percentage',
125
+ dollar: 'currency-dollar',
126
+ euro: 'currency-euro',
127
+
128
+ // Communication
129
+ mail: 'mail',
130
+ message: 'message',
131
+ comment: 'message-circle',
132
+ phone: 'phone',
133
+
134
+ // System & dev
135
+ cloud: 'cloud',
136
+ cloudUpload: 'cloud-upload',
137
+ cloudDownload: 'cloud-download',
138
+ api: 'api',
139
+ code: 'code',
140
+ bug: 'bug',
141
+ tool: 'tool',
142
+ robot: 'robot',
143
+
144
+ // Location
145
+ map: 'map',
146
+ compass: 'compass',
147
+ global: 'world',
148
+ location: 'map-pin',
149
+
150
+ // Shapes & objects
151
+ star: 'star',
152
+ heart: 'heart',
153
+ flag: 'flag',
154
+ trophy: 'trophy',
155
+ medal: 'medal',
156
+ rocket: 'rocket',
157
+ fire: 'flame',
158
+ thunder: 'bolt',
159
+ smile: 'mood-smile',
160
+ frown: 'mood-sad',
161
+ like: 'thumb-up',
162
+ dislike: 'thumb-down',
163
+ safety: 'shield-check',
164
+ key: 'key',
165
+ };
@@ -13,9 +13,13 @@ export default function ListItemRender($desc, instance) {
13
13
 
14
14
  if ($desc.disabled) {
15
15
  props.class.add('is-disabled', $desc.disabled);
16
+ // [a11y] aria-disabled
17
+ props['aria-disabled'] = $desc.disabled;
16
18
  }
17
19
  if ($desc.selected) {
18
20
  props.class.add('is-selected', $desc.selected);
21
+ // [a11y] aria-selected
22
+ props['aria-selected'] = $desc.selected;
19
23
  }
20
24
  if ($desc.visibility) {
21
25
  props.class.add('is-hidden', $desc.visibility.isFalsy());
@@ -24,6 +24,14 @@ export default function MenuItemRender($desc, instance) {
24
24
 
25
25
  if(hasSubmenu) {
26
26
  props.class.add('has-submenu');
27
+ // [a11y] aria-haspopup for submenu items
28
+ props['aria-haspopup'] = 'menu';
29
+ props['aria-expanded'] = 'false';
30
+ }
31
+
32
+ // [a11y] aria-disabled
33
+ if($desc.disabled) {
34
+ props['aria-disabled'] = $desc.disabled;
27
35
  }
28
36
 
29
37
  const content = [