native-document 1.0.166 → 1.0.169

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 (139) hide show
  1. package/.vitepress/config.js +166 -0
  2. package/CHANGELOG.md +187 -0
  3. package/components.js +4 -1
  4. package/dist/native-document.components.min.js +593 -300
  5. package/dist/native-document.dev.js +99 -75
  6. package/dist/native-document.dev.js.map +1 -1
  7. package/dist/native-document.min.js +1 -1
  8. package/docs/advanced-components.md +213 -608
  9. package/docs/anchor.md +173 -312
  10. package/docs/cache.md +95 -803
  11. package/docs/cli.md +179 -0
  12. package/docs/components/accordion.md +172 -0
  13. package/docs/components/alert.md +99 -0
  14. package/docs/components/avatar.md +160 -0
  15. package/docs/components/badge.md +102 -0
  16. package/docs/components/breadcrumb.md +89 -0
  17. package/docs/components/button.md +183 -0
  18. package/docs/components/card.md +69 -0
  19. package/docs/components/context-menu.md +118 -0
  20. package/docs/components/data-table.md +345 -0
  21. package/docs/components/dropdown.md +214 -0
  22. package/docs/components/form/autocomplete-field.md +81 -0
  23. package/docs/components/form/checkbox-field.md +41 -0
  24. package/docs/components/form/checkbox-group-field.md +54 -0
  25. package/docs/components/form/color-field.md +64 -0
  26. package/docs/components/form/date-field.md +92 -0
  27. package/docs/components/form/field-collection.md +63 -0
  28. package/docs/components/form/file-field.md +203 -0
  29. package/docs/components/form/form-control.md +87 -0
  30. package/docs/components/form/image-field.md +90 -0
  31. package/docs/components/form/index.md +115 -0
  32. package/docs/components/form/number-field.md +65 -0
  33. package/docs/components/form/radio-field.md +51 -0
  34. package/docs/components/form/select-field.md +123 -0
  35. package/docs/components/form/slider.md +136 -0
  36. package/docs/components/form/string-field.md +134 -0
  37. package/docs/components/form/textarea-field.md +65 -0
  38. package/docs/components/form-fields.md +372 -0
  39. package/docs/components/getting-started.md +264 -0
  40. package/docs/components/icons.md +321 -0
  41. package/docs/components/index.md +337 -0
  42. package/docs/components/layout.md +279 -0
  43. package/docs/components/list.md +73 -0
  44. package/docs/components/menu.md +215 -0
  45. package/docs/components/modal.md +156 -0
  46. package/docs/components/pagination.md +95 -0
  47. package/docs/components/popover.md +131 -0
  48. package/docs/components/progress.md +111 -0
  49. package/docs/components/shortcut-manager.md +221 -0
  50. package/docs/components/simple-table.md +107 -0
  51. package/docs/components/skeleton.md +155 -0
  52. package/docs/components/spinner.md +100 -0
  53. package/docs/components/splitter.md +133 -0
  54. package/docs/components/stepper.md +163 -0
  55. package/docs/components/switch.md +113 -0
  56. package/docs/components/tabs.md +153 -0
  57. package/docs/components/toast.md +119 -0
  58. package/docs/components/tooltip.md +151 -0
  59. package/docs/components/traits.md +261 -0
  60. package/docs/conditional-rendering.md +170 -588
  61. package/docs/contributing.md +300 -25
  62. package/docs/core-concepts.md +205 -374
  63. package/docs/elements.md +251 -367
  64. package/docs/extending-native-document-element.md +192 -207
  65. package/docs/filters.md +153 -1122
  66. package/docs/getting-started.md +193 -267
  67. package/docs/i18n.md +241 -0
  68. package/docs/index.md +76 -0
  69. package/docs/lifecycle-events.md +143 -75
  70. package/docs/list-rendering.md +227 -852
  71. package/docs/memory-management.md +134 -47
  72. package/docs/native-document-element.md +337 -186
  73. package/docs/native-fetch.md +99 -630
  74. package/docs/observable-resource.md +364 -0
  75. package/docs/observables.md +592 -526
  76. package/docs/routing.md +244 -653
  77. package/docs/state-management.md +134 -241
  78. package/docs/svg-elements.md +231 -0
  79. package/docs/theming.md +409 -0
  80. package/docs/tutorials/.gitkeep +0 -0
  81. package/docs/validation.md +95 -97
  82. package/docs/vitepress-conventions.md +219 -0
  83. package/package.json +34 -13
  84. package/readme.md +269 -89
  85. package/src/components/card/Card.js +93 -39
  86. package/src/components/card/index.js +1 -1
  87. package/src/components/form/field/types/FileField.js +3 -3
  88. package/src/components/icon/Icon.js +107 -0
  89. package/src/components/icon/icon-getters.js +142 -0
  90. package/src/components/icon/icons.js +171 -0
  91. package/src/components/icon/index.js +17 -0
  92. package/src/components/icon/types/Icon.d.ts +191 -0
  93. package/src/components/index.d.ts +6 -1
  94. package/src/components/list/HasListItem.js +171 -0
  95. package/src/components/list/List.js +41 -107
  96. package/src/components/list/ListDivider.js +39 -0
  97. package/src/components/list/ListGroup.js +76 -59
  98. package/src/components/list/ListItem.js +117 -69
  99. package/src/components/list/index.js +3 -1
  100. package/src/components/list/types/List.d.ts +45 -32
  101. package/src/components/list/types/ListDivider.ts +16 -0
  102. package/src/components/list/types/ListGroup.d.ts +51 -29
  103. package/src/components/list/types/ListItem.d.ts +40 -30
  104. package/src/components/spacer/Spacer.js +1 -1
  105. package/src/core/data/ObservableResource.js +5 -0
  106. package/src/core/data/observable-helpers/observable.prototypes.js +2 -0
  107. package/src/core/elements/content-formatter.js +16 -2
  108. package/src/core/elements/form.js +1 -1
  109. package/src/core/elements/img.js +1 -1
  110. package/src/core/elements/medias.js +2 -2
  111. package/src/core/elements/meta-data.js +1 -1
  112. package/src/core/wrappers/AttributesWrapper.js +37 -22
  113. package/src/core/wrappers/ElementCreator.js +9 -16
  114. package/src/core/wrappers/HtmlElementWrapper.js +26 -7
  115. package/src/core/wrappers/NDElement.js +12 -1
  116. package/src/core/wrappers/prototypes/attributes-extensions.js +24 -24
  117. package/src/core/wrappers/prototypes/nd-element-extensions.js +1 -8
  118. package/src/ui/components/card/CardRender.js +133 -0
  119. package/src/ui/components/card/card.css +169 -0
  120. package/src/ui/components/contextmenu/ContextmenuRender.js +1 -1
  121. package/src/ui/components/icon/material/MaterialIconRender.js +71 -0
  122. package/src/ui/components/icon/material/material.css +15 -0
  123. package/src/ui/components/icon/material/material.map.js +170 -0
  124. package/src/ui/components/icon/phosphor/PhosphorIconRender.js +71 -0
  125. package/src/ui/components/icon/phosphor/phosphor.css +17 -0
  126. package/src/ui/components/icon/phosphor/phosphor.map.js +165 -0
  127. package/src/ui/components/icon/tabler/TablerIconRender.js +59 -0
  128. package/src/ui/components/icon/tabler/tabler.css +14 -0
  129. package/src/ui/components/icon/tabler/tabler.map.js +165 -0
  130. package/src/ui/components/list/ListRender.js +18 -0
  131. package/src/ui/components/list/divider/ListDividerRender.js +10 -0
  132. package/src/ui/components/list/divider/list-divider.css +12 -0
  133. package/src/ui/components/list/group/ListGroupRender.js +61 -0
  134. package/src/ui/components/list/group/list-group.css +62 -0
  135. package/src/ui/components/list/item/ListItemRender.js +238 -0
  136. package/src/ui/components/list/item/list-item.css +191 -0
  137. package/src/ui/components/list/list.css +24 -0
  138. package/src/ui/components/spacer/SpacerRender.js +10 -0
  139. package/src/ui/index.js +13 -0
@@ -0,0 +1,71 @@
1
+ import './material.css';
2
+ import MAP from './material.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 class
13
+ // Material Icons uses the class as the font-family selector
14
+ const VARIANT_CLASS = {
15
+ fill: 'material-icons',
16
+ regular: 'material-icons',
17
+ outline: 'material-icons-outlined',
18
+ round: 'material-icons-round',
19
+ sharp: 'material-icons-sharp',
20
+ twoTone: 'material-icons-two-tone',
21
+ };
22
+
23
+ /**
24
+ * Renders a Google Material Icon as a <span> element using CSS webfont ligatures.
25
+ * The icon name is the text content of the element — Material Icons uses ligatures.
26
+ *
27
+ * Variants: fill/regular (default), outline, round, sharp, twoTone
28
+ * Each variant requires its own CSS - see material.css.
29
+ *
30
+ * @param {object} $desc
31
+ * @param {string} $desc.name
32
+ * @param {'fill'|'regular'|'outline'|'round'|'sharp'|'twoTone'|Observable<string>|null} $desc.variant
33
+ * @param {'small'|'medium'|'large'|'extraLarge'|number|Observable<string|number>|null} $desc.size
34
+ * @param {string|Observable<string>|null} $desc.color
35
+ * @returns {HTMLElement}
36
+ */
37
+ export default function MaterialIconRender($desc) {
38
+ const materialName = MAP[$desc.name] ?? $desc.name;
39
+ const style = {};
40
+
41
+ let className;
42
+
43
+ if($desc.variant?.__$Observable) {
44
+ className = $desc.variant.transform((variant) => {
45
+ return VARIANT_CLASS[variant] ?? VARIANT_CLASS.fill;
46
+ });
47
+ } else {
48
+ className = VARIANT_CLASS[$desc.variant] ?? VARIANT_CLASS.fill;
49
+ }
50
+
51
+ if($desc.size?.__$Observable) {
52
+ style.fontSize = $desc.size.transform((size) => {
53
+ const px = typeof size === 'number' ? size : (SIZES[size] ?? SIZES.medium);
54
+ return `${px}px`;
55
+ });
56
+ } else {
57
+ const px = typeof $desc.size === 'number' ? $desc.size : (SIZES[$desc.size] ?? SIZES.medium);
58
+ style.fontSize = `${px}px`;
59
+ }
60
+
61
+ if($desc.color) {
62
+ style.color = $desc.color;
63
+ }
64
+
65
+ // Material Icons uses ligatures — the icon name is the text content
66
+ return Span({
67
+ 'aria-hidden': 'true',
68
+ class: className,
69
+ style,
70
+ }, materialName);
71
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Google Material Icons webfont
3
+ * Install : npm install material-icons
4
+ *
5
+ * Import only the variants you need.
6
+ */
7
+ /*@import 'material-icons/iconfont/filled.css';*/
8
+
9
+ /*
10
+ * Uncomment the variants you need:
11
+ */
12
+ /* @import 'material-icons/iconfont/outlined.css'; */
13
+ /* @import 'material-icons/iconfont/round.css'; */
14
+ /* @import 'material-icons/iconfont/sharp.css'; */
15
+ /* @import 'material-icons/iconfont/two-tone.css'; */
@@ -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,59 @@
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
+ console.log(style);
53
+
54
+ return Italic({
55
+ 'aria-hidden': 'true',
56
+ style,
57
+ class: className,
58
+ });
59
+ }
@@ -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'; */