@tangible/ui 0.2.33 → 0.2.34

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.
@@ -0,0 +1,268 @@
1
+ import { spriteIcon } from '../utils/sprite-icon.js';
2
+
3
+ export const iconRegistry = {
4
+ 'cred/badge-check': spriteIcon('tui-cred-badge-check', '0 0 24 24', 'cred/badge-check'),
5
+ 'cred/badge-ribbon': spriteIcon('tui-cred-badge-ribbon', '0 0 24 24', 'cred/badge-ribbon'),
6
+ 'cred/badge': spriteIcon('tui-cred-badge', '0 0 24 24', 'cred/badge'),
7
+ 'cred/check-circle': spriteIcon('tui-cred-check-circle', '0 0 24 24', 'cred/check-circle'),
8
+ 'cred/clock': spriteIcon('tui-cred-clock', '0 0 24 24', 'cred/clock'),
9
+ 'cred/coin': spriteIcon('tui-cred-coin', '0 0 24 24', 'cred/coin'),
10
+ 'cred/crown': spriteIcon('tui-cred-crown', '0 0 24 24', 'cred/crown'),
11
+ 'cred/heart': spriteIcon('tui-cred-heart', '0 0 24 24', 'cred/heart'),
12
+ 'cred/hourglass': spriteIcon('tui-cred-hourglass', '0 0 24 24', 'cred/hourglass'),
13
+ 'cred/star': spriteIcon('tui-cred-star', '0 0 24 24', 'cred/star'),
14
+ 'cred/timer': spriteIcon('tui-cred-timer', '0 0 24 24', 'cred/timer'),
15
+ 'cred/trophy': spriteIcon('tui-cred-trophy', '0 0 24 24', 'cred/trophy'),
16
+ 'lms/book': spriteIcon('tui-lms-book-fill', '0 0 24 24', 'lms/book'),
17
+ 'lms/block-course': spriteIcon('tui-lms-block-course', '0 0 24 24', 'lms/block-course'),
18
+ 'lms/block-stat': spriteIcon('tui-lms-block-stat', '0 0 24 24', 'lms/block-stat'),
19
+ 'lms/block-stats': spriteIcon('tui-lms-block-stats', '0 0 24 24', 'lms/block-stats'),
20
+ 'lms/book-fill': spriteIcon('tui-lms-book-fill', '0 0 24 24', 'lms/book-fill'),
21
+ 'lms/book-outline': spriteIcon('tui-lms-book-outline', '0 0 24 24', 'lms/book-outline'),
22
+ 'lms/bookmark-fill': spriteIcon('tui-lms-bookmark-fill', '0 0 24 24', 'lms/bookmark-fill'),
23
+ 'lms/bookmark-outline': spriteIcon('tui-lms-bookmark-outline', '0 0 24 24', 'lms/bookmark-outline'),
24
+ 'lms/branch': spriteIcon('tui-lms-branch', '0 0 24 24', 'lms/branch'),
25
+ 'lms/calendar': spriteIcon('tui-lms-calendar', '0 0 24 24', 'lms/calendar'),
26
+ 'lms/checkmark': spriteIcon('tui-lms-checkmark', '0 0 24 24', 'lms/checkmark'),
27
+ 'lms/clock-outline': spriteIcon('tui-lms-clock-outline', '0 0 24 24', 'lms/clock-outline'),
28
+ 'lms/clock-progress': spriteIcon('tui-lms-clock-progress', '0 0 24 24', 'lms/clock-progress'),
29
+ 'lms/clock-progress-partial': spriteIcon('tui-lms-clock-progress-partial', '0 0 24 24', 'lms/clock-progress-partial'),
30
+ 'lms/comments': spriteIcon('tui-lms-comments', '0 0 24 24', 'lms/comments'),
31
+ 'lms/convert': spriteIcon('tui-lms-convert', '0 0 24 24', 'lms/convert'),
32
+ 'lms/course-syllabus': spriteIcon('tui-lms-course-syllabus', '0 0 24 24', 'lms/course-syllabus'),
33
+ 'lms/custom-progress': spriteIcon('tui-lms-custom-progress', '0 0 24 24', 'lms/custom-progress'),
34
+ 'lms/draft-saved': spriteIcon('tui-lms-draft-saved', '0 0 24 24', 'lms/draft-saved'),
35
+ 'lms/duration-fill': spriteIcon('tui-lms-duration-fill', '0 0 24 24', 'lms/duration-fill'),
36
+ 'lms/duration-outline': spriteIcon('tui-lms-duration-outline', '0 0 24 24', 'lms/duration-outline'),
37
+ 'lms/edit-externally': spriteIcon('tui-lms-edit-externally', '0 0 24 24', 'lms/edit-externally'),
38
+ 'lms/free-form': spriteIcon('tui-lms-free-form', '0 0 24 24', 'lms/free-form'),
39
+ 'lms/help-circle-fill': spriteIcon('tui-lms-help-circle-fill', '0 0 24 24', 'lms/help-circle-fill'),
40
+ 'lms/help-circle-outline': spriteIcon('tui-lms-help-circle-outline', '0 0 24 24', 'lms/help-circle-outline'),
41
+ 'lms/hidden': spriteIcon('tui-lms-hidden', '0 0 24 24', 'lms/hidden'),
42
+ 'lms/info': spriteIcon('tui-lms-info', '0 0 24 24', 'lms/info'),
43
+ 'lms/inspector-sidebar': spriteIcon('tui-lms-inspector-sidebar', '0 0 24 24', 'lms/inspector-sidebar'),
44
+ 'lms/item-type-page': spriteIcon('tui-lms-item-type-page', '0 0 24 24', 'lms/item-type-page'),
45
+ 'lms/item-type-section': spriteIcon('tui-lms-item-type-section', '0 0 24 24', 'lms/item-type-section'),
46
+ 'lms/item-type-text': spriteIcon('tui-lms-item-type-text', '0 0 24 24', 'lms/item-type-text'),
47
+ 'lms/item-type-video': spriteIcon('tui-lms-item-type-video', '0 0 24 24', 'lms/item-type-video'),
48
+ 'lms/keyhole': spriteIcon('tui-lms-keyhole', '0 0 24 24', 'lms/keyhole'),
49
+ 'lms/linear-bisection': spriteIcon('tui-lms-linear-bisection', '0 0 24 24', 'lms/linear-bisection'),
50
+ 'lms/linear-progression': spriteIcon('tui-lms-linear-progression', '0 0 24 24', 'lms/linear-progression'),
51
+ 'lms/list-view': spriteIcon('tui-lms-list-view', '0 0 24 24', 'lms/list-view'),
52
+ 'lms/notes': spriteIcon('tui-lms-notes', '0 0 24 24', 'lms/notes'),
53
+ 'lms/play-fill': spriteIcon('tui-lms-play-fill', '0 0 24 24', 'lms/play-fill'),
54
+ 'lms/prerequisites': spriteIcon('tui-lms-prerequisites', '0 0 24 24', 'lms/prerequisites'),
55
+ 'lms/prerequisites-in': spriteIcon('tui-lms-prerequisites-in', '0 0 24 24', 'lms/prerequisites-in'),
56
+ 'lms/prerequisites-out': spriteIcon('tui-lms-prerequisites-out', '0 0 24 24', 'lms/prerequisites-out'),
57
+ 'lms/presentation': spriteIcon('tui-lms-presentation', '0 0 24 24', 'lms/presentation'),
58
+ 'lms/question-mark': spriteIcon('tui-lms-question-mark', '0 0 24 24', 'lms/question-mark'),
59
+ 'lms/switch-branch': spriteIcon('tui-lms-switch-branch', '0 0 24 24', 'lms/switch-branch'),
60
+ 'lms/visible': spriteIcon('tui-lms-visible', '0 0 24 24', 'lms/visible'),
61
+ 'membersync/arrow-left': spriteIcon('tui-membersync-arrow-left', '0 0 24 24', 'membersync/arrow-left'),
62
+ 'membersync/cart': spriteIcon('tui-membersync-cart', '0 0 24 24', 'membersync/cart'),
63
+ 'membersync/check': spriteIcon('tui-membersync-check', '0 0 24 24', 'membersync/check'),
64
+ 'membersync/chevron-down': spriteIcon('tui-membersync-chevron-down', '0 0 24 24', 'membersync/chevron-down'),
65
+ 'membersync/chevron-left': spriteIcon('tui-membersync-chevron-left', '0 0 24 24', 'membersync/chevron-left'),
66
+ 'membersync/chevron-right': spriteIcon('tui-membersync-chevron-right', '0 0 24 24', 'membersync/chevron-right'),
67
+ 'membersync/chevron-up': spriteIcon('tui-membersync-chevron-up', '0 0 24 24', 'membersync/chevron-up'),
68
+ 'membersync/close': spriteIcon('tui-membersync-close', '0 0 24 24', 'membersync/close'),
69
+ 'membersync/cog': spriteIcon('tui-membersync-cog', '0 0 24 24', 'membersync/cog'),
70
+ 'membersync/download': spriteIcon('tui-membersync-download', '0 0 24 24', 'membersync/download'),
71
+ 'membersync/exit': spriteIcon('tui-membersync-exit', '0 0 24 24', 'membersync/exit'),
72
+ 'membersync/file-pdf': spriteIcon('tui-membersync-file-pdf', '0 0 24 24', 'membersync/file-pdf'),
73
+ 'membersync/filter': spriteIcon('tui-membersync-filter', '0 0 24 24', 'membersync/filter'),
74
+ 'membersync/home': spriteIcon('tui-membersync-home', '0 0 24 24', 'membersync/home'),
75
+ 'membersync/license': spriteIcon('tui-membersync-license', '0 0 24 24', 'membersync/license'),
76
+ 'membersync/plus': spriteIcon('tui-membersync-plus', '0 0 24 24', 'membersync/plus'),
77
+ 'membersync/report': spriteIcon('tui-membersync-report', '0 0 24 24', 'membersync/report'),
78
+ 'membersync/reverse': spriteIcon('tui-membersync-reverse', '0 0 24 24', 'membersync/reverse'),
79
+ 'membersync/search': spriteIcon('tui-membersync-search', '0 0 24 24', 'membersync/search'),
80
+ 'membersync/table-column': spriteIcon('tui-membersync-table-column', '0 0 24 24', 'membersync/table-column'),
81
+ 'membersync/table-row': spriteIcon('tui-membersync-table-row', '0 0 24 24', 'membersync/table-row'),
82
+ 'membersync/users': spriteIcon('tui-membersync-users', '0 0 24 24', 'membersync/users'),
83
+ 'player/captions-fill': spriteIcon('tui-player-captions-fill', '0 0 24 24', 'player/captions-fill'),
84
+ 'player/captions-outline': spriteIcon('tui-player-captions-outline', '0 0 24 24', 'player/captions-outline'),
85
+ 'player/next': spriteIcon('tui-player-next', '0 0 24 24', 'player/next'),
86
+ 'player/pause': spriteIcon('tui-player-pause', '0 0 24 24', 'player/pause'),
87
+ 'player/picture-in-picture': spriteIcon('tui-player-picture-in-picture', '0 0 24 24', 'player/picture-in-picture'),
88
+ 'player/play': spriteIcon('tui-player-play', '0 0 24 24', 'player/play'),
89
+ 'player/playlist': spriteIcon('tui-player-playlist', '0 0 24 24', 'player/playlist'),
90
+ 'player/previous': spriteIcon('tui-player-previous', '0 0 24 24', 'player/previous'),
91
+ 'player/repeat-one': spriteIcon('tui-player-repeat-one', '0 0 24 24', 'player/repeat-one'),
92
+ 'player/repeat': spriteIcon('tui-player-repeat', '0 0 24 24', 'player/repeat'),
93
+ 'player/shuffle': spriteIcon('tui-player-shuffle', '0 0 24 24', 'player/shuffle'),
94
+ 'player/skip-backwards': spriteIcon('tui-player-skip-backwards', '0 0 24 24', 'player/skip-backwards'),
95
+ 'player/skip-forward': spriteIcon('tui-player-skip-forward', '0 0 24 24', 'player/skip-forward'),
96
+ 'player/stop': spriteIcon('tui-player-stop', '0 0 24 24', 'player/stop'),
97
+ 'player/transcript-fill': spriteIcon('tui-player-transcript-fill', '0 0 24 24', 'player/transcript-fill'),
98
+ 'player/transcript-outline': spriteIcon('tui-player-transcript-outline', '0 0 24 24', 'player/transcript-outline'),
99
+ 'player/view-default': spriteIcon('tui-player-view-default', '0 0 24 24', 'player/view-default'),
100
+ 'player/view-expanded': spriteIcon('tui-player-view-expanded', '0 0 24 24', 'player/view-expanded'),
101
+ 'player/view-full': spriteIcon('tui-player-view-full', '0 0 24 24', 'player/view-full'),
102
+ 'player/volume-bar-h': spriteIcon('tui-player-volume-bar-h', '0 0 24 24', 'player/volume-bar-h'),
103
+ 'player/volume-bar-v': spriteIcon('tui-player-volume-bar-v', '0 0 24 24', 'player/volume-bar-v'),
104
+ 'player/volume-high': spriteIcon('tui-player-volume-high', '0 0 24 24', 'player/volume-high'),
105
+ 'player/volume-low': spriteIcon('tui-player-volume-low', '0 0 24 24', 'player/volume-low'),
106
+ 'player/volume-mute': spriteIcon('tui-player-volume-mute', '0 0 24 24', 'player/volume-mute'),
107
+ 'reaction/arrow-thick-down-fill': spriteIcon('tui-reaction-arrow-thick-down-fill', '0 0 24 24', 'reaction/arrow-thick-down-fill'),
108
+ 'reaction/arrow-thick-down-outline': spriteIcon('tui-reaction-arrow-thick-down-outline', '0 0 24 24', 'reaction/arrow-thick-down-outline'),
109
+ 'reaction/arrow-thick-up-fill': spriteIcon('tui-reaction-arrow-thick-up-fill', '0 0 24 24', 'reaction/arrow-thick-up-fill'),
110
+ 'reaction/arrow-thick-up-outline': spriteIcon('tui-reaction-arrow-thick-up-outline', '0 0 24 24', 'reaction/arrow-thick-up-outline'),
111
+ 'reaction/arrow-thin-down-fill': spriteIcon('tui-reaction-arrow-thin-down-fill', '0 0 24 24', 'reaction/arrow-thin-down-fill'),
112
+ 'reaction/arrow-thin-down-outline': spriteIcon('tui-reaction-arrow-thin-down-outline', '0 0 24 24', 'reaction/arrow-thin-down-outline'),
113
+ 'reaction/arrow-thin-up-fill': spriteIcon('tui-reaction-arrow-thin-up-fill', '0 0 24 24', 'reaction/arrow-thin-up-fill'),
114
+ 'reaction/arrow-thin-up-outline': spriteIcon('tui-reaction-arrow-thin-up-outline', '0 0 24 24', 'reaction/arrow-thin-up-outline'),
115
+ 'reaction/bookmark-fill': spriteIcon('tui-reaction-bookmark-fill', '0 0 24 24', 'reaction/bookmark-fill'),
116
+ 'reaction/bookmark-outline': spriteIcon('tui-reaction-bookmark-outline', '0 0 24 24', 'reaction/bookmark-outline'),
117
+ 'reaction/chevron-down-fill': spriteIcon('tui-reaction-chevron-down-fill', '0 0 24 24', 'reaction/chevron-down-fill'),
118
+ 'reaction/chevron-down-outline': spriteIcon('tui-reaction-chevron-down-outline', '0 0 24 24', 'reaction/chevron-down-outline'),
119
+ 'reaction/chevron-up-fill': spriteIcon('tui-reaction-chevron-up-fill', '0 0 24 24', 'reaction/chevron-up-fill'),
120
+ 'reaction/chevron-up-outline': spriteIcon('tui-reaction-chevron-up-outline', '0 0 24 24', 'reaction/chevron-up-outline'),
121
+ 'reaction/clap-fill': spriteIcon('tui-reaction-clap-fill', '0 0 24 24', 'reaction/clap-fill'),
122
+ 'reaction/clap-outline': spriteIcon('tui-reaction-clap-outline', '0 0 24 24', 'reaction/clap-outline'),
123
+ 'reaction/exclamation-point-fill': spriteIcon('tui-reaction-exclamation-point-fill', '0 0 24 24', 'reaction/exclamation-point-fill'),
124
+ 'reaction/exclamation-point-outline': spriteIcon('tui-reaction-exclamation-point-outline', '0 0 24 24', 'reaction/exclamation-point-outline'),
125
+ 'reaction/heart-fill': spriteIcon('tui-reaction-heart-fill', '0 0 24 24', 'reaction/heart-fill'),
126
+ 'reaction/heart-outline': spriteIcon('tui-reaction-heart-outline', '0 0 24 24', 'reaction/heart-outline'),
127
+ 'reaction/laughing-fill': spriteIcon('tui-reaction-laughing-fill', '0 0 24 24', 'reaction/laughing-fill'),
128
+ 'reaction/laughing-outline': spriteIcon('tui-reaction-laughing-outline', '0 0 24 24', 'reaction/laughing-outline'),
129
+ 'reaction/question-mark-fill': spriteIcon('tui-reaction-question-mark-fill', '0 0 24 24', 'reaction/question-mark-fill'),
130
+ 'reaction/question-mark-outline': spriteIcon('tui-reaction-question-mark-outline', '0 0 24 24', 'reaction/question-mark-outline'),
131
+ 'reaction/star-fill': spriteIcon('tui-reaction-star-fill', '0 0 24 24', 'reaction/star-fill'),
132
+ 'reaction/star-outline': spriteIcon('tui-reaction-star-outline', '0 0 24 24', 'reaction/star-outline'),
133
+ 'reaction/star-shine-fill': spriteIcon('tui-reaction-star-shine-fill', '0 0 24 24', 'reaction/star-shine-fill'),
134
+ 'reaction/star-shine-outline': spriteIcon('tui-reaction-star-shine-outline', '0 0 24 24', 'reaction/star-shine-outline'),
135
+ 'reaction/thumbs-down-fill': spriteIcon('tui-reaction-thumbs-down-fill', '0 0 24 24', 'reaction/thumbs-down-fill'),
136
+ 'reaction/thumbs-down-outline': spriteIcon('tui-reaction-thumbs-down-outline', '0 0 24 24', 'reaction/thumbs-down-outline'),
137
+ 'reaction/thumbs-up': spriteIcon('tui-reaction-thumbs-up', '0 0 24 24', 'reaction/thumbs-up'),
138
+ 'reaction/thumbs-up-outline': spriteIcon('tui-reaction-thumbs-up-outline', '0 0 24 24', 'reaction/thumbs-up-outline'),
139
+ 'reaction/triangle-down-fill': spriteIcon('tui-reaction-triangle-down-fill', '0 0 24 24', 'reaction/triangle-down-fill'),
140
+ 'reaction/triangle-down-outline': spriteIcon('tui-reaction-triangle-down-outline', '0 0 24 24', 'reaction/triangle-down-outline'),
141
+ 'reaction/triangle-up-fill': spriteIcon('tui-reaction-triangle-up-fill', '0 0 24 24', 'reaction/triangle-up-fill'),
142
+ 'reaction/triangle-up-outline': spriteIcon('tui-reaction-triangle-up-outline', '0 0 24 24', 'reaction/triangle-up-outline'),
143
+ 'system/alert-circle-fill': spriteIcon('tui-system-alert-circle-fill', '0 0 24 24', 'system/alert-circle-fill'),
144
+ 'system/alert-circle-outline': spriteIcon('tui-system-alert-circle-outline', '0 0 24 24', 'system/alert-circle-outline'),
145
+ 'system/alert-triangle': spriteIcon('tui-system-alert-triangle', '0 0 24 24', 'system/alert-triangle'),
146
+ 'system/arrow-clockwise': spriteIcon('tui-system-arrow-clockwise', '0 0 24 24', 'system/arrow-clockwise'),
147
+ 'system/arrow-counterclockwise': spriteIcon('tui-system-arrow-counterclockwise', '0 0 24 24', 'system/arrow-counterclockwise'),
148
+ 'system/arrow-down': spriteIcon('tui-system-arrow-down', '0 0 24 24', 'system/arrow-down'),
149
+ 'system/arrow-left': spriteIcon('tui-system-arrow-left', '0 0 24 24', 'system/arrow-left'),
150
+ 'system/arrow-right': spriteIcon('tui-system-arrow-right', '0 0 24 24', 'system/arrow-right'),
151
+ 'system/arrow-up': spriteIcon('tui-system-arrow-up', '0 0 24 24', 'system/arrow-up'),
152
+ 'system/attachment': spriteIcon('tui-system-attachment', '0 0 24 24', 'system/attachment'),
153
+ 'system/bell-unread': spriteIcon('tui-system-bell-unread', '0 0 24 24', 'system/bell-unread'),
154
+ 'system/bell': spriteIcon('tui-system-bell', '0 0 24 24', 'system/bell'),
155
+ 'system/building': spriteIcon('tui-system-building', '0 0 24 24', 'system/building'),
156
+ 'system/chart': spriteIcon('tui-system-chart', '0 0 24 24', 'system/chart'),
157
+ 'system/check-circle-fill': spriteIcon('tui-system-check-circle-fill', '0 0 24 24', 'system/check-circle-fill'),
158
+ 'system/check-circle-outline': spriteIcon('tui-system-check-circle-outline', '0 0 24 24', 'system/check-circle-outline'),
159
+ 'system/check-small': spriteIcon('tui-system-check-small', '0 0 24 24', 'system/check-small'),
160
+ 'system/check': spriteIcon('tui-system-check', '0 0 24 24', 'system/check'),
161
+ 'system/checklist': spriteIcon('tui-system-checklist', '0 0 24 24', 'system/checklist'),
162
+ 'system/chevron-down-small': spriteIcon('tui-system-chevron-down-small', '0 0 24 24', 'system/chevron-down-small'),
163
+ 'system/chevron-down': spriteIcon('tui-system-chevron-down', '0 0 24 24', 'system/chevron-down'),
164
+ 'system/chevron-left-double': spriteIcon('tui-system-chevron-left-double', '0 0 24 24', 'system/chevron-left-double'),
165
+ 'system/chevron-left-small': spriteIcon('tui-system-chevron-left-small', '0 0 24 24', 'system/chevron-left-small'),
166
+ 'system/chevron-left': spriteIcon('tui-system-chevron-left', '0 0 24 24', 'system/chevron-left'),
167
+ 'system/chevron-right-double': spriteIcon('tui-system-chevron-right-double', '0 0 24 24', 'system/chevron-right-double'),
168
+ 'system/chevron-right-small': spriteIcon('tui-system-chevron-right-small', '0 0 24 24', 'system/chevron-right-small'),
169
+ 'system/chevron-right': spriteIcon('tui-system-chevron-right', '0 0 24 24', 'system/chevron-right'),
170
+ 'system/chevron-up-small': spriteIcon('tui-system-chevron-up-small', '0 0 24 24', 'system/chevron-up-small'),
171
+ 'system/chevron-up': spriteIcon('tui-system-chevron-up', '0 0 24 24', 'system/chevron-up'),
172
+ 'system/circle-fill': spriteIcon('tui-system-circle-fill', '0 0 24 24', 'system/circle-fill'),
173
+ 'system/circle-outline': spriteIcon('tui-system-circle-outline', '0 0 24 24', 'system/circle-outline'),
174
+ 'system/circle-small-fill': spriteIcon('tui-system-circle-small-fill', '0 0 24 24', 'system/circle-small-fill'),
175
+ 'system/circle-small-outline': spriteIcon('tui-system-circle-small-outline', '0 0 24 24', 'system/circle-small-outline'),
176
+ 'system/close-circle-fill': spriteIcon('tui-system-close-circle-fill', '0 0 24 24', 'system/close-circle-fill'),
177
+ 'system/close-circle-outline': spriteIcon('tui-system-close-circle-outline', '0 0 24 24', 'system/close-circle-outline'),
178
+ 'system/close-small': spriteIcon('tui-system-close-small', '0 0 24 24', 'system/close-small'),
179
+ 'system/close': spriteIcon('tui-system-close', '0 0 24 24', 'system/close'),
180
+ 'system/cloud-check': spriteIcon('tui-system-cloud-check', '0 0 24 24', 'system/cloud-check'),
181
+ 'system/cloud': spriteIcon('tui-system-cloud', '0 0 24 24', 'system/cloud'),
182
+ 'system/cog': spriteIcon('tui-system-cog', '0 0 24 24', 'system/cog'),
183
+ 'system/copy': spriteIcon('tui-system-copy', '0 0 24 24', 'system/copy'),
184
+ 'system/credit-card': spriteIcon('tui-system-credit-card', '0 0 24 24', 'system/credit-card'),
185
+ 'system/drag': spriteIcon('tui-system-drag', '0 0 24 24', 'system/drag'),
186
+ 'system/download': spriteIcon('tui-system-download', '0 0 24 24', 'system/download'),
187
+ 'system/duplicate': spriteIcon('tui-system-duplicate', '0 0 24 24', 'system/duplicate'),
188
+ 'system/edit': spriteIcon('tui-system-edit', '0 0 24 24', 'system/edit'),
189
+ 'system/edit-small': spriteIcon('tui-system-edit-small', '0 0 24 24', 'system/edit-small'),
190
+ 'system/ellipsis-h': spriteIcon('tui-system-ellipsis-h', '0 0 24 24', 'system/ellipsis-h'),
191
+ 'system/ellipsis-v': spriteIcon('tui-system-ellipsis-v', '0 0 24 24', 'system/ellipsis-v'),
192
+ 'system/envelope': spriteIcon('tui-system-envelope', '0 0 24 24', 'system/envelope'),
193
+ 'system/external-link': spriteIcon('tui-system-external-link', '0 0 24 24', 'system/external-link'),
194
+ 'system/folder': spriteIcon('tui-system-folder', '0 0 24 24', 'system/folder'),
195
+ 'system/funnel': spriteIcon('tui-system-funnel', '0 0 24 24', 'system/funnel'),
196
+ 'system/globe': spriteIcon('tui-system-globe', '0 0 24 24', 'system/globe'),
197
+ 'system/handle-alt': spriteIcon('tui-system-handle-alt', '0 0 24 24', 'system/handle-alt'),
198
+ 'system/handle': spriteIcon('tui-system-handle', '0 0 24 24', 'system/handle'),
199
+ 'system/help-circle-fill': spriteIcon('tui-system-help-circle-fill', '0 0 24 24', 'system/help-circle-fill'),
200
+ 'system/help-circle-outline': spriteIcon('tui-system-help', '0 0 24 24', 'system/help-circle-outline'),
201
+ 'system/help': spriteIcon('tui-system-help', '0 0 24 24', 'system/help'),
202
+ 'system/hide': spriteIcon('tui-system-hide', '0 0 24 24', 'system/hide'),
203
+ 'system/highlight': spriteIcon('tui-system-highlight', '0 0 24 24', 'system/highlight'),
204
+ 'system/home-fill': spriteIcon('tui-system-home-fill', '0 0 24 24', 'system/home-fill'),
205
+ 'system/home-outline': spriteIcon('tui-system-home-outline', '0 0 24 24', 'system/home-outline'),
206
+ 'system/image': spriteIcon('tui-system-image', '0 0 24 24', 'system/image'),
207
+ 'system/inbox': spriteIcon('tui-system-inbox', '0 0 24 24', 'system/inbox'),
208
+ 'system/info': spriteIcon('tui-system-info', '0 0 24 24', 'system/info'),
209
+ 'system/key': spriteIcon('tui-system-key', '0 0 24 24', 'system/key'),
210
+ 'system/link': spriteIcon('tui-system-link', '0 0 24 24', 'system/link'),
211
+ 'system/lock-fill': spriteIcon('tui-system-lock-fill', '0 0 24 24', 'system/lock-fill'),
212
+ 'system/lock-outline': spriteIcon('tui-system-lock-outline', '0 0 24 24', 'system/lock-outline'),
213
+ 'system/lock-small': spriteIcon('tui-system-lock-small', '0 0 24 24', 'system/lock-small'),
214
+ 'system/lock': spriteIcon('tui-system-lock-fill', '0 0 24 24', 'system/lock'),
215
+ 'system/log-out': spriteIcon('tui-system-log-out', '0 0 24 24', 'system/log-out'),
216
+ 'system/minus-circle-fill': spriteIcon('tui-system-minus-circle-fill', '0 0 24 24', 'system/minus-circle-fill'),
217
+ 'system/minus-circle-outline': spriteIcon('tui-system-minus-circle-outline', '0 0 24 24', 'system/minus-circle-outline'),
218
+ 'system/minus': spriteIcon('tui-system-minus', '0 0 24 24', 'system/minus'),
219
+ 'system/moon-fill': spriteIcon('tui-system-moon-fill', '0 0 24 24', 'system/moon-fill'),
220
+ 'system/moon-outline': spriteIcon('tui-system-moon-outline', '0 0 24 24', 'system/moon-outline'),
221
+ 'system/paste': spriteIcon('tui-system-paste', '0 0 24 24', 'system/paste'),
222
+ 'system/pin-small': spriteIcon('tui-system-pin-small', '0 0 24 24', 'system/pin-small'),
223
+ 'system/pin': spriteIcon('tui-system-pin', '0 0 24 24', 'system/pin'),
224
+ 'system/plus-circle-fill': spriteIcon('tui-system-plus-circle-fill', '0 0 24 24', 'system/plus-circle-fill'),
225
+ 'system/plus-circle-outline': spriteIcon('tui-system-plus-circle-outline', '0 0 24 24', 'system/plus-circle-outline'),
226
+ 'system/plus-small': spriteIcon('tui-system-plus-small', '0 0 24 24', 'system/plus-small'),
227
+ 'system/plus': spriteIcon('tui-system-plus', '0 0 24 24', 'system/plus'),
228
+ 'system/question-mark': spriteIcon('tui-system-question-mark', '0 0 24 24', 'system/question-mark'),
229
+ 'system/recurring': spriteIcon('tui-system-recurring', '0 0 24 24', 'system/recurring'),
230
+ 'system/redo': spriteIcon('tui-system-redo', '0 0 24 24', 'system/redo'),
231
+ 'system/refresh': spriteIcon('tui-system-arrow-counterclockwise', '0 0 24 24', 'system/refresh'),
232
+ 'system/sun-fill': spriteIcon('tui-system-sun-fill', '0 0 24 24', 'system/sun-fill'),
233
+ 'system/sun-outline': spriteIcon('tui-system-sun-outline', '0 0 24 24', 'system/sun-outline'),
234
+ 'system/undo': spriteIcon('tui-system-undo', '0 0 24 24', 'system/undo'),
235
+ 'system/reverse': spriteIcon('tui-system-reverse', '0 0 24 24', 'system/reverse'),
236
+ 'system/rotate': spriteIcon('tui-system-arrow-counterclockwise', '0 0 24 24', 'system/rotate'),
237
+ 'system/search': spriteIcon('tui-system-search', '0 0 24 24', 'system/search'),
238
+ 'system/send': spriteIcon('tui-system-send', '0 0 24 24', 'system/send'),
239
+ 'system/settings': spriteIcon('tui-system-settings', '0 0 24 24', 'system/settings'),
240
+ 'system/show': spriteIcon('tui-system-show', '0 0 24 24', 'system/show'),
241
+ 'system/sidebar-collapse': spriteIcon('tui-system-sidebar-collapse', '0 0 24 24', 'system/sidebar-collapse'),
242
+ 'system/sidebar-expand': spriteIcon('tui-system-sidebar-expand', '0 0 24 24', 'system/sidebar-expand'),
243
+ 'system/star-fill': spriteIcon('tui-system-star-fill', '0 0 24 24', 'system/star-fill'),
244
+ 'system/star-half': spriteIcon('tui-system-star-half', '0 0 24 24', 'system/star-half'),
245
+ 'system/star-outline': spriteIcon('tui-system-star-outline', '0 0 24 24', 'system/star-outline'),
246
+ 'system/store': spriteIcon('tui-system-store', '0 0 24 24', 'system/store'),
247
+ 'system/bolt-fill': spriteIcon('tui-system-bolt-fill', '0 0 24 24', 'system/bolt-fill'),
248
+ 'system/bolt-outline': spriteIcon('tui-system-bolt-outline', '0 0 24 24', 'system/bolt-outline'),
249
+ 'system/bolt-plus-fill': spriteIcon('tui-system-bolt-plus-fill', '0 0 24 24', 'system/bolt-plus-fill'),
250
+ 'system/bolt-plus-outline': spriteIcon('tui-system-bolt-plus-outline', '0 0 24 24', 'system/bolt-plus-outline'),
251
+ 'system/custom-function': spriteIcon('tui-system-custom-function', '0 0 24 24', 'system/custom-function'),
252
+ 'system/loop': spriteIcon('tui-system-loop', '0 0 24 24', 'system/loop'),
253
+ 'system/nest': spriteIcon('tui-system-nest', '0 0 24 24', 'system/nest'),
254
+ 'system/tool': spriteIcon('tui-system-tool', '0 0 24 24', 'system/tool'),
255
+ 'system/trash': spriteIcon('tui-system-trash', '0 0 24 24', 'system/trash'),
256
+ 'system/unlink': spriteIcon('tui-system-unlink', '0 0 24 24', 'system/unlink'),
257
+ 'system/unlock-fill': spriteIcon('tui-system-unlock-fill', '0 0 24 24', 'system/unlock-fill'),
258
+ 'system/unlock-outline': spriteIcon('tui-system-unlock-outline', '0 0 24 24', 'system/unlock-outline'),
259
+ 'system/unlock': spriteIcon('tui-system-unlock-fill', '0 0 24 24', 'system/unlock'),
260
+ 'system/upload': spriteIcon('tui-system-upload', '0 0 24 24', 'system/upload'),
261
+ 'system/user-circle-fill': spriteIcon('tui-system-user-circle-fill', '0 0 24 24', 'system/user-circle-fill'),
262
+ 'system/user-circle-outline': spriteIcon('tui-system-user-circle-outline', '0 0 24 24', 'system/user-circle-outline'),
263
+ 'system/users': spriteIcon('tui-system-users', '0 0 24 24', 'system/users'),
264
+ 'system/view': spriteIcon('tui-system-view', '0 0 24 24', 'system/view'),
265
+ 'system/view-off': spriteIcon('tui-system-view-off', '0 0 24 24', 'system/view-off'),
266
+ };
267
+
268
+ export const iconOptions = Object.keys(iconRegistry);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The TUI version that built the sprites. tools/build-icons.js overwrites the
3
+ * compiled file with the package version; source builds (Storybook, tests)
4
+ * see this placeholder.
5
+ */
6
+ export declare const SPRITE_VERSION = "0.0.0";
@@ -0,0 +1 @@
1
+ export const SPRITE_VERSION = '0.2.34';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Sprite delivery for icons (opt-in through 0.2.x; see sprite-design.md).
3
+ *
4
+ * `sprite-registry.js` (generated into the package) maps every icon name to a
5
+ * component that renders `<use href="#tui-<set>-<name>">`. The symbols reach
6
+ * the page one of two ways:
7
+ * - printed by the server (`icons/sprite.php`), or
8
+ * - `injectIconSprite()`, which fetches each set's sprite and inserts it.
9
+ *
10
+ * A `<use>` reference to another file must be same-origin, and Chrome refuses
11
+ * `data:` URLs in `<use>`; fetching and inserting avoids both, so a CDN copy
12
+ * of TUI or a single-file bundle still works.
13
+ */
14
+ export declare const iconSets: readonly ["system", "cred", "reaction", "player", "lms", "membersync"];
15
+ export type IconSetName = (typeof iconSets)[number];
16
+ /** Fired on the document after a sprite is inserted (re-runs the dev check). */
17
+ export declare const SPRITE_EVENT = "tui-icon-sprite";
18
+ export type InjectIconSpriteOptions = {
19
+ /** Sets to load. @default ['system'] */
20
+ sets?: readonly IconSetName[];
21
+ /**
22
+ * Where each set's sprite lives. Defaults to the file next to this module,
23
+ * which `vite build` emits as an asset. Vite's dev server pre-bundles the
24
+ * package and can't serve it, so in Vite pass `?url` imports instead:
25
+ * `import systemUrl from '@tangible/ui/icons/system.svg?url'`.
26
+ */
27
+ spriteUrl?: (set: IconSetName) => string;
28
+ /**
29
+ * The document to insert into. Defaults to the global one; pass an iframe's
30
+ * (the WordPress block editor canvas), since `<use href="#…">` resolves
31
+ * within its own document.
32
+ */
33
+ document?: Document;
34
+ };
35
+ export type InjectIconSpriteResult = {
36
+ /** Sets now in the page, whether this call or an earlier one put them there. */
37
+ loaded: IconSetName[];
38
+ /** Sets that couldn't be loaded. Icons from them render empty. */
39
+ failed: IconSetName[];
40
+ };
41
+ /**
42
+ * Fetch each set's sprite and insert it at the start of `<body>`, once. Sets
43
+ * already in the page from this TUI version or newer (printed by the server,
44
+ * or injected earlier) are skipped, so it's safe to call from every entry
45
+ * point. Call it before rendering icons, without awaiting it: icons from a
46
+ * set fill in when it lands.
47
+ *
48
+ * Never rejects. The result lists the sets that failed, so a CDN blip can't
49
+ * take the app down with it.
50
+ */
51
+ export declare function injectIconSprite(options?: InjectIconSpriteOptions): Promise<InjectIconSpriteResult>;
52
+ /** Resolves once `doc` is parsed and its pending sprites have settled. @internal */
53
+ export declare function spritesSettled(doc: Document): Promise<void>;
@@ -0,0 +1,196 @@
1
+ import { isDev } from '../utils/is-dev.js';
2
+ import { SPRITE_VERSION } from './sprite-version.js';
3
+ /**
4
+ * Sprite delivery for icons (opt-in through 0.2.x; see sprite-design.md).
5
+ *
6
+ * `sprite-registry.js` (generated into the package) maps every icon name to a
7
+ * component that renders `<use href="#tui-<set>-<name>">`. The symbols reach
8
+ * the page one of two ways:
9
+ * - printed by the server (`icons/sprite.php`), or
10
+ * - `injectIconSprite()`, which fetches each set's sprite and inserts it.
11
+ *
12
+ * A `<use>` reference to another file must be same-origin, and Chrome refuses
13
+ * `data:` URLs in `<use>`; fetching and inserting avoids both, so a CDN copy
14
+ * of TUI or a single-file bundle still works.
15
+ */
16
+ export const iconSets = ['system', 'cred', 'reaction', 'player', 'lms', 'membersync'];
17
+ /** Marks a sprite container; its value lists the sets it holds ("all" for icons.svg). */
18
+ const SPRITE_ATTR = 'data-tui-icon-sprite';
19
+ /** The TUI version that produced a container, so a newer copy can top it up. */
20
+ const VERSION_ATTR = 'data-tui-icon-sprite-version';
21
+ /** Fired on the document after a sprite is inserted (re-runs the dev check). */
22
+ export const SPRITE_EVENT = 'tui-icon-sprite';
23
+ /**
24
+ * The sprite file shipped next to this module. Written out per set, because
25
+ * bundlers only emit `new URL('./x', import.meta.url)` as an asset when the
26
+ * path is a static string.
27
+ */
28
+ function defaultSpriteUrl(set) {
29
+ switch (set) {
30
+ case 'system': return new URL('./system.svg', import.meta.url).href;
31
+ case 'cred': return new URL('./cred.svg', import.meta.url).href;
32
+ case 'reaction': return new URL('./reaction.svg', import.meta.url).href;
33
+ case 'player': return new URL('./player.svg', import.meta.url).href;
34
+ case 'lms': return new URL('./lms.svg', import.meta.url).href;
35
+ case 'membersync': return new URL('./membersync.svg', import.meta.url).href;
36
+ }
37
+ }
38
+ const pending = new WeakMap();
39
+ function pendingFor(doc) {
40
+ let map = pending.get(doc);
41
+ if (!map)
42
+ pending.set(doc, (map = new Map()));
43
+ return map;
44
+ }
45
+ /** Numeric compare of "major.minor.patch" (pre-release tags ignored). */
46
+ function newer(a, b) {
47
+ const pa = a.split(/[.-]/).map(Number);
48
+ const pb = b.split(/[.-]/).map(Number);
49
+ for (let i = 0; i < 3; i++) {
50
+ if ((pa[i] || 0) !== (pb[i] || 0))
51
+ return (pa[i] || 0) > (pb[i] || 0);
52
+ }
53
+ return false;
54
+ }
55
+ /**
56
+ * Whether the page already holds `set` from this TUI version or a newer one.
57
+ * An older copy (another plugin bundling an earlier TUI) may lack icons added
58
+ * since, so it doesn't count: this copy inserts its own ahead of it, and the
59
+ * first symbol with an id wins.
60
+ */
61
+ function hasSet(doc, set) {
62
+ return Array.from(doc.querySelectorAll(`[${SPRITE_ATTR}]`)).some((el) => {
63
+ const sets = (el.getAttribute(SPRITE_ATTR) ?? '').split(/\s+/);
64
+ if (!sets.includes(set) && !sets.includes('all'))
65
+ return false;
66
+ const version = el.getAttribute(VERSION_ATTR);
67
+ return !version || !newer(SPRITE_VERSION, version);
68
+ });
69
+ }
70
+ // An allowlist, not a blocklist: `spriteUrl` can point anywhere, and markup
71
+ // inserted into the page can run script (an XHTML iframe), restyle it
72
+ // (<style>) or rebase every URL (<base>). TUI's sprites use a handful of
73
+ // shape elements; everything else is dropped.
74
+ const SVG_NS = 'http://www.w3.org/2000/svg';
75
+ const ELEMENTS = new Set([
76
+ 'symbol', 'g', 'path', 'defs', 'clipPath', 'mask', 'circle', 'rect', 'ellipse', 'line',
77
+ 'polyline', 'polygon', 'linearGradient', 'radialGradient', 'stop',
78
+ ]);
79
+ const ATTRIBUTES = new Set([
80
+ 'id', 'viewBox', 'd', 'fill', 'fill-rule', 'clip-rule', 'clip-path', 'mask', 'opacity',
81
+ 'fill-opacity', 'stroke', 'stroke-width', 'stroke-linecap', 'stroke-linejoin',
82
+ 'stroke-miterlimit', 'stroke-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'transform',
83
+ 'cx', 'cy', 'r', 'rx', 'ry', 'x', 'y', 'width', 'height', 'x1', 'y1', 'x2', 'y2', 'points',
84
+ 'offset', 'stop-color', 'stop-opacity', 'gradientUnits', 'gradientTransform', 'clipPathUnits',
85
+ 'maskUnits', 'maskContentUnits',
86
+ ]);
87
+ /** A clean copy of `el`, or null if it isn't an allowed SVG element. */
88
+ function cleanCopy(doc, el) {
89
+ if (el.namespaceURI !== SVG_NS || !ELEMENTS.has(el.localName))
90
+ return null;
91
+ const copy = doc.createElementNS(SVG_NS, el.localName);
92
+ for (const attr of Array.from(el.attributes)) {
93
+ if (attr.namespaceURI || !ATTRIBUTES.has(attr.name))
94
+ continue;
95
+ // Paint and clip references may only point inside the document.
96
+ if (/url\(/i.test(attr.value) && !/^\s*url\(\s*['"]?#[\w-]+['"]?\s*\)\s*$/i.test(attr.value))
97
+ continue;
98
+ copy.setAttribute(attr.name, attr.value);
99
+ }
100
+ for (const child of Array.from(el.children)) {
101
+ const clean = cleanCopy(doc, child);
102
+ if (clean)
103
+ copy.appendChild(clean);
104
+ }
105
+ return copy;
106
+ }
107
+ function parseSymbols(doc, markup) {
108
+ const parsed = new DOMParser().parseFromString(markup, 'image/svg+xml');
109
+ if (parsed.querySelector('parsererror'))
110
+ return [];
111
+ return Array.from(parsed.querySelectorAll('symbol'))
112
+ .map((symbol) => cleanCopy(doc, symbol))
113
+ .filter((symbol) => !!symbol);
114
+ }
115
+ function whenBody(doc) {
116
+ if (doc.body)
117
+ return Promise.resolve(doc.body);
118
+ return new Promise((resolve) => doc.addEventListener('DOMContentLoaded', () => resolve(doc.body), { once: true }));
119
+ }
120
+ async function insertSprite(doc, set, symbols) {
121
+ const svg = doc.createElementNS(SVG_NS, 'svg');
122
+ svg.setAttribute(SPRITE_ATTR, set);
123
+ svg.setAttribute(VERSION_ATTR, SPRITE_VERSION);
124
+ svg.setAttribute('aria-hidden', 'true');
125
+ svg.setAttribute('focusable', 'false');
126
+ // Through the style object, which a strict CSP allows where a style
127
+ // attribute is blocked. Not display:none: some engines drop gradients and
128
+ // masks from symbols inside an undisplayed container.
129
+ Object.assign(svg.style, {
130
+ position: 'absolute', width: '0', height: '0', overflow: 'hidden',
131
+ });
132
+ svg.append(...symbols);
133
+ (await whenBody(doc)).prepend(svg);
134
+ doc.dispatchEvent(new Event(SPRITE_EVENT));
135
+ }
136
+ async function loadSet(doc, set, href) {
137
+ try {
138
+ const res = await fetch(href);
139
+ if (!res.ok)
140
+ throw new Error(`HTTP ${res.status}`);
141
+ const symbols = parseSymbols(doc, await res.text());
142
+ // An HTML fallback page (a dev server, an SPA host) answers 200 too.
143
+ if (!symbols.length)
144
+ throw new Error('the response holds no SVG symbols');
145
+ if (!hasSet(doc, set))
146
+ await insertSprite(doc, set, symbols);
147
+ return true;
148
+ }
149
+ catch (err) {
150
+ if (isDev())
151
+ console.warn(`[injectIconSprite] Couldn't load the "${set}" sprite from ${href}:`, err);
152
+ return false;
153
+ }
154
+ }
155
+ /**
156
+ * Fetch each set's sprite and insert it at the start of `<body>`, once. Sets
157
+ * already in the page from this TUI version or newer (printed by the server,
158
+ * or injected earlier) are skipped, so it's safe to call from every entry
159
+ * point. Call it before rendering icons, without awaiting it: icons from a
160
+ * set fill in when it lands.
161
+ *
162
+ * Never rejects. The result lists the sets that failed, so a CDN blip can't
163
+ * take the app down with it.
164
+ */
165
+ export async function injectIconSprite(options = {}) {
166
+ const { sets = ['system'], spriteUrl = defaultSpriteUrl } = options;
167
+ const doc = options.document ?? (typeof document === 'undefined' ? undefined : document);
168
+ if (!doc)
169
+ return { loaded: [], failed: [...sets] };
170
+ const inFlight = pendingFor(doc);
171
+ const results = await Promise.all(sets.map((set) => {
172
+ if (hasSet(doc, set))
173
+ return Promise.resolve(true);
174
+ const href = spriteUrl(set);
175
+ const key = `${set} ${href}`;
176
+ let load = inFlight.get(key);
177
+ if (!load) {
178
+ load = loadSet(doc, set, href).finally(() => inFlight.delete(key));
179
+ inFlight.set(key, load);
180
+ }
181
+ return load;
182
+ }));
183
+ return {
184
+ loaded: sets.filter((_, i) => results[i]),
185
+ failed: sets.filter((_, i) => !results[i]),
186
+ };
187
+ }
188
+ /** Resolves once `doc` is parsed and its pending sprites have settled. @internal */
189
+ export function spritesSettled(doc) {
190
+ const parsed = doc.readyState === 'loading'
191
+ ? new Promise((resolve) => doc.addEventListener('DOMContentLoaded', () => resolve(), { once: true }))
192
+ : Promise.resolve();
193
+ return parsed
194
+ .then(() => Promise.allSettled([...(pending.get(doc)?.values() ?? [])]))
195
+ .then(() => undefined);
196
+ }
@@ -0,0 +1,85 @@
1
+ <?php
2
+ /**
3
+ * Print Tangible UI's icon sprite into the page, for the sprite registry
4
+ * (`@tangible/ui/icons/sprite-registry.js`) to reference with <use href="#…">.
5
+ *
6
+ * Printing on the server is the recommended path in WordPress: no fetch, no
7
+ * flash of empty icons. Copy this file and the `<set>.svg` files beside it
8
+ * from `node_modules/@tangible/ui/icons/` into your plugin's build output
9
+ * (node_modules doesn't ship), then print the sets the page uses:
10
+ *
11
+ * require_once __DIR__ . '/assets/tui-icons/sprite.php';
12
+ * add_action('admin_footer', function () {
13
+ * tangible_ui_print_icon_sprite(['system']);
14
+ * });
15
+ *
16
+ * Several plugins can each bundle a copy, at different TUI versions. Every
17
+ * copy registers itself when included, and the helper prints from the newest,
18
+ * so icons added in a later version are never missing. Each set prints once
19
+ * per request, and `injectIconSprite()` skips sets already printed. Plain PHP,
20
+ * no WordPress functions.
21
+ */
22
+
23
+ // Replaced with the package version at build time.
24
+ $GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.34';
25
+
26
+ if (!function_exists('tangible_ui_print_icon_sprite')) {
27
+ /**
28
+ * @param string|string[] $sets Icon sets to print: 'system', 'cred',
29
+ * 'reaction', 'player', 'lms', 'membersync'.
30
+ */
31
+ function tangible_ui_print_icon_sprite($sets = ['system']): void {
32
+ static $printed = [];
33
+
34
+ // The newest registered copy supplies the files.
35
+ $dir = null;
36
+ $version = '0.0.0';
37
+ foreach ($GLOBALS['tangible_ui_icon_sprite_copies'] ?? [] as $copy => $copy_version) {
38
+ if ($dir === null || version_compare($copy_version, $version, '>')) {
39
+ $dir = $copy;
40
+ $version = $copy_version;
41
+ }
42
+ }
43
+ if ($dir === null) {
44
+ return;
45
+ }
46
+
47
+ $symbols = '';
48
+ $names = [];
49
+ foreach ((array) $sets as $set) {
50
+ if (!is_string($set) || !preg_match('/^[a-z][a-z-]*$/', $set)) {
51
+ trigger_error('tangible_ui_print_icon_sprite: invalid set name', E_USER_WARNING);
52
+ continue;
53
+ }
54
+ if (isset($printed[$set])) {
55
+ continue;
56
+ }
57
+ $file = $dir . '/' . $set . '.svg';
58
+ if (!is_file($file)) {
59
+ trigger_error("tangible_ui_print_icon_sprite: no sprite for set \"$set\"", E_USER_WARNING);
60
+ continue;
61
+ }
62
+ // Only the <symbol>s, whatever else the file holds (a prolog, comments).
63
+ preg_match_all('/<symbol\b.*?<\/symbol>/s', (string) file_get_contents($file), $matches);
64
+ if (!$matches[0]) {
65
+ continue;
66
+ }
67
+ $symbols .= implode('', $matches[0]);
68
+ $names[] = $set;
69
+ $printed[$set] = true;
70
+ }
71
+
72
+ if ($names === []) {
73
+ return;
74
+ }
75
+
76
+ // Not display:none: some engines drop gradients and masks from symbols
77
+ // inside an undisplayed container.
78
+ echo '<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"'
79
+ . ' data-tui-icon-sprite="' . htmlspecialchars(implode(' ', $names), ENT_QUOTES) . '"'
80
+ . ' data-tui-icon-sprite-version="' . htmlspecialchars($version, ENT_QUOTES) . '"'
81
+ . ' style="position:absolute;width:0;height:0;overflow:hidden">'
82
+ . $symbols
83
+ . '</svg>';
84
+ }
85
+ }