@knowcode/doc-builder 1.5.11 → 1.5.13

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,267 @@
1
+ /**
2
+ * Emoji to Phosphor Icons mapping
3
+ * Maps Unicode emojis to their Phosphor icon equivalents
4
+ */
5
+
6
+ const emojiToPhosphor = {
7
+ // Status & Validation
8
+ '✅': '<i class="ph ph-check-circle" aria-label="checked"></i>',
9
+ '✓': '<i class="ph ph-check" aria-label="check"></i>',
10
+ '✔️': '<i class="ph ph-check-square" aria-label="checked"></i>',
11
+ '❌': '<i class="ph ph-x-circle" aria-label="error"></i>',
12
+ '❓': '<i class="ph ph-question" aria-label="question"></i>',
13
+ '❗': '<i class="ph ph-warning" aria-label="warning"></i>',
14
+ '⚠️': '<i class="ph ph-warning-circle" aria-label="warning"></i>',
15
+ '⛔': '<i class="ph ph-prohibit" aria-label="prohibited"></i>',
16
+ '🚫': '<i class="ph ph-prohibit-inset" aria-label="not allowed"></i>',
17
+
18
+ // Development & Tech
19
+ '💻': '<i class="ph ph-laptop" aria-label="laptop"></i>',
20
+ '🖥️': '<i class="ph ph-desktop" aria-label="desktop"></i>',
21
+ '📱': '<i class="ph ph-device-mobile" aria-label="mobile"></i>',
22
+ '⌨️': '<i class="ph ph-keyboard" aria-label="keyboard"></i>',
23
+ '🖱️': '<i class="ph ph-mouse" aria-label="mouse"></i>',
24
+ '💾': '<i class="ph ph-floppy-disk" aria-label="save"></i>',
25
+ '💿': '<i class="ph ph-disc" aria-label="disc"></i>',
26
+ '🔧': '<i class="ph ph-wrench" aria-label="settings"></i>',
27
+ '🔨': '<i class="ph ph-hammer" aria-label="build"></i>',
28
+ '⚙️': '<i class="ph ph-gear" aria-label="settings"></i>',
29
+ '🛠️': '<i class="ph ph-gear-six" aria-label="tools"></i>',
30
+ '⚡': '<i class="ph ph-lightning" aria-label="fast"></i>',
31
+ '🔌': '<i class="ph ph-plug" aria-label="plugin"></i>',
32
+ '💡': '<i class="ph ph-lightbulb" aria-label="idea"></i>',
33
+ '🐛': '<i class="ph ph-bug" aria-label="bug"></i>',
34
+ '🐞': '<i class="ph ph-bug-beetle" aria-label="bug"></i>',
35
+ '🤖': '<i class="ph ph-robot" aria-label="automation"></i>',
36
+
37
+ // Documents & Files
38
+ '📝': '<i class="ph ph-note-pencil" aria-label="edit"></i>',
39
+ '📄': '<i class="ph ph-file-text" aria-label="document"></i>',
40
+ '📃': '<i class="ph ph-file" aria-label="file"></i>',
41
+ '📋': '<i class="ph ph-clipboard-text" aria-label="clipboard"></i>',
42
+ '📁': '<i class="ph ph-folder" aria-label="folder"></i>',
43
+ '📂': '<i class="ph ph-folder-open" aria-label="open folder"></i>',
44
+ '🗂️': '<i class="ph ph-folders" aria-label="folders"></i>',
45
+ '📚': '<i class="ph ph-books" aria-label="documentation"></i>',
46
+ '📖': '<i class="ph ph-book-open" aria-label="reading"></i>',
47
+ '📕': '<i class="ph ph-book" aria-label="book"></i>',
48
+ '📗': '<i class="ph ph-book" aria-label="book"></i>',
49
+ '📘': '<i class="ph ph-book" aria-label="book"></i>',
50
+ '📙': '<i class="ph ph-book" aria-label="book"></i>',
51
+ '📓': '<i class="ph ph-notebook" aria-label="notebook"></i>',
52
+ '📔': '<i class="ph ph-notebook" aria-label="journal"></i>',
53
+
54
+ // UI & Design
55
+ '🎨': '<i class="ph ph-palette" aria-label="design"></i>',
56
+ '🖌️': '<i class="ph ph-paint-brush" aria-label="paint"></i>',
57
+ '🖍️': '<i class="ph ph-pencil" aria-label="draw"></i>',
58
+ '✏️': '<i class="ph ph-pencil-simple" aria-label="edit"></i>',
59
+ '✒️': '<i class="ph ph-pen" aria-label="write"></i>',
60
+ '🖊️': '<i class="ph ph-pen-nib" aria-label="pen"></i>',
61
+ '🖋️': '<i class="ph ph-pen-nib-straight" aria-label="fountain pen"></i>',
62
+ '📐': '<i class="ph ph-ruler" aria-label="measure"></i>',
63
+ '📏': '<i class="ph ph-ruler" aria-label="ruler"></i>',
64
+
65
+ // Actions & Navigation
66
+ '🚀': '<i class="ph ph-rocket-launch" aria-label="launch"></i>',
67
+ '✈️': '<i class="ph ph-airplane" aria-label="deploy"></i>',
68
+ '🎯': '<i class="ph ph-target" aria-label="goal"></i>',
69
+ '🏁': '<i class="ph ph-flag-checkered" aria-label="finish"></i>',
70
+ '🚩': '<i class="ph ph-flag" aria-label="flag"></i>',
71
+ '📍': '<i class="ph ph-push-pin" aria-label="pin"></i>',
72
+ '📌': '<i class="ph ph-push-pin" aria-label="pinned"></i>',
73
+ '🔗': '<i class="ph ph-link" aria-label="link"></i>',
74
+ '⚓': '<i class="ph ph-anchor" aria-label="anchor"></i>',
75
+ '🧭': '<i class="ph ph-compass" aria-label="navigation"></i>',
76
+ '🗺️': '<i class="ph ph-map-trifold" aria-label="map"></i>',
77
+
78
+ // Communication
79
+ '📧': '<i class="ph ph-envelope" aria-label="email"></i>',
80
+ '📨': '<i class="ph ph-envelope-open" aria-label="inbox"></i>',
81
+ '📬': '<i class="ph ph-mailbox" aria-label="mailbox"></i>',
82
+ '📮': '<i class="ph ph-mailbox" aria-label="postbox"></i>',
83
+ '💬': '<i class="ph ph-chat-circle" aria-label="chat"></i>',
84
+ '💭': '<i class="ph ph-chat-circle-dots" aria-label="thinking"></i>',
85
+ '🗨️': '<i class="ph ph-chat-teardrop" aria-label="comment"></i>',
86
+ '📢': '<i class="ph ph-megaphone" aria-label="announce"></i>',
87
+ '📣': '<i class="ph ph-megaphone-simple" aria-label="broadcast"></i>',
88
+ '🔔': '<i class="ph ph-bell" aria-label="notification"></i>',
89
+ '🔕': '<i class="ph ph-bell-slash" aria-label="muted"></i>',
90
+
91
+ // Security
92
+ '🔐': '<i class="ph ph-lock-key" aria-label="secure"></i>',
93
+ '🔒': '<i class="ph ph-lock" aria-label="locked"></i>',
94
+ '🔓': '<i class="ph ph-lock-open" aria-label="unlocked"></i>',
95
+ '🔑': '<i class="ph ph-key" aria-label="key"></i>',
96
+ '🗝️': '<i class="ph ph-key" aria-label="key"></i>',
97
+ '🛡️': '<i class="ph ph-shield" aria-label="security"></i>',
98
+ '⚔️': '<i class="ph ph-sword" aria-label="battle"></i>',
99
+
100
+ // Analytics & Data
101
+ '📊': '<i class="ph ph-chart-bar" aria-label="chart"></i>',
102
+ '📈': '<i class="ph ph-chart-line-up" aria-label="growth"></i>',
103
+ '📉': '<i class="ph ph-chart-line-down" aria-label="decline"></i>',
104
+ '🔍': '<i class="ph ph-magnifying-glass" aria-label="search"></i>',
105
+ '🔎': '<i class="ph ph-magnifying-glass-plus" aria-label="zoom in"></i>',
106
+ '🔬': '<i class="ph ph-flask" aria-label="experiment"></i>',
107
+ '🔭': '<i class="ph ph-binoculars" aria-label="explore"></i>',
108
+
109
+ // Time
110
+ '⏰': '<i class="ph ph-alarm" aria-label="alarm"></i>',
111
+ '⏱️': '<i class="ph ph-timer" aria-label="timer"></i>',
112
+ '⏲️': '<i class="ph ph-timer" aria-label="stopwatch"></i>',
113
+ '🕐': '<i class="ph ph-clock" aria-label="time"></i>',
114
+ '📅': '<i class="ph ph-calendar" aria-label="calendar"></i>',
115
+ '📆': '<i class="ph ph-calendar-blank" aria-label="date"></i>',
116
+ '🗓️': '<i class="ph ph-calendar" aria-label="schedule"></i>',
117
+
118
+ // Media
119
+ '📷': '<i class="ph ph-camera" aria-label="photo"></i>',
120
+ '📸': '<i class="ph ph-camera" aria-label="screenshot"></i>',
121
+ '📹': '<i class="ph ph-video-camera" aria-label="video"></i>',
122
+ '🎥': '<i class="ph ph-film-strip" aria-label="movie"></i>',
123
+ '📽️': '<i class="ph ph-film-slate" aria-label="production"></i>',
124
+ '🎬': '<i class="ph ph-film-slate" aria-label="action"></i>',
125
+ '🎤': '<i class="ph ph-microphone" aria-label="microphone"></i>',
126
+ '🎧': '<i class="ph ph-headphones" aria-label="audio"></i>',
127
+ '🎵': '<i class="ph ph-music-note" aria-label="music"></i>',
128
+ '🎶': '<i class="ph ph-music-notes" aria-label="music"></i>',
129
+ '🔊': '<i class="ph ph-speaker-high" aria-label="volume high"></i>',
130
+ '🔇': '<i class="ph ph-speaker-none" aria-label="muted"></i>',
131
+ '🔈': '<i class="ph ph-speaker-low" aria-label="volume low"></i>',
132
+
133
+ // Nature & Weather
134
+ '☀️': '<i class="ph ph-sun" aria-label="sunny"></i>',
135
+ '🌙': '<i class="ph ph-moon" aria-label="night"></i>',
136
+ '⭐': '<i class="ph ph-star" aria-label="star"></i>',
137
+ '🌟': '<i class="ph ph-star-four" aria-label="sparkle"></i>',
138
+ '✨': '<i class="ph ph-sparkle" aria-label="special"></i>',
139
+ '☁️': '<i class="ph ph-cloud" aria-label="cloud"></i>',
140
+ '🌧️': '<i class="ph ph-cloud-rain" aria-label="rain"></i>',
141
+ '❄️': '<i class="ph ph-snowflake" aria-label="snow"></i>',
142
+ '🔥': '<i class="ph ph-fire" aria-label="hot"></i>',
143
+ '💧': '<i class="ph ph-drop" aria-label="water"></i>',
144
+ '🌊': '<i class="ph ph-waves" aria-label="wave"></i>',
145
+
146
+ // People & Activities
147
+ '👤': '<i class="ph ph-user" aria-label="user"></i>',
148
+ '👥': '<i class="ph ph-users" aria-label="team"></i>',
149
+ '👨‍💻': '<i class="ph ph-user-circle" aria-label="developer"></i>',
150
+ '🏃': '<i class="ph ph-person-simple-run" aria-label="running"></i>',
151
+ '🚶': '<i class="ph ph-person-simple-walk" aria-label="walking"></i>',
152
+ '🤝': '<i class="ph ph-handshake" aria-label="partnership"></i>',
153
+ '👍': '<i class="ph ph-thumbs-up" aria-label="approve"></i>',
154
+ '👎': '<i class="ph ph-thumbs-down" aria-label="disapprove"></i>',
155
+ '👏': '<i class="ph ph-hands-clapping" aria-label="applause"></i>',
156
+ '🙌': '<i class="ph ph-hands-clapping" aria-label="celebrate"></i>',
157
+ '💪': '<i class="ph ph-hand-fist" aria-label="strong"></i>',
158
+
159
+ // Objects & Things
160
+ '🏠': '<i class="ph ph-house" aria-label="home"></i>',
161
+ '🏢': '<i class="ph ph-buildings" aria-label="office"></i>',
162
+ '🏭': '<i class="ph ph-factory" aria-label="factory"></i>',
163
+ '🚗': '<i class="ph ph-car" aria-label="car"></i>',
164
+ '🚌': '<i class="ph ph-bus" aria-label="bus"></i>',
165
+ '🚂': '<i class="ph ph-train" aria-label="train"></i>',
166
+ '🚁': '<i class="ph ph-airplane" aria-label="helicopter"></i>',
167
+ '🚢': '<i class="ph ph-boat" aria-label="ship"></i>',
168
+ '🎁': '<i class="ph ph-gift" aria-label="gift"></i>',
169
+ '🎈': '<i class="ph ph-balloon" aria-label="celebration"></i>',
170
+ '🎉': '<i class="ph ph-confetti" aria-label="party"></i>',
171
+ '🏆': '<i class="ph ph-trophy" aria-label="achievement"></i>',
172
+ '🥇': '<i class="ph ph-medal" aria-label="first place"></i>',
173
+ '🎮': '<i class="ph ph-game-controller" aria-label="gaming"></i>',
174
+ '🎲': '<i class="ph ph-dice-five" aria-label="random"></i>',
175
+
176
+ // Food & Drink
177
+ '☕': '<i class="ph ph-coffee" aria-label="coffee"></i>',
178
+ '🍔': '<i class="ph ph-hamburger" aria-label="burger"></i>',
179
+ '🍕': '<i class="ph ph-pizza" aria-label="pizza"></i>',
180
+ '🍰': '<i class="ph ph-cake" aria-label="cake"></i>',
181
+ '🍺': '<i class="ph ph-beer-stein" aria-label="beer"></i>',
182
+ '🍷': '<i class="ph ph-wine" aria-label="wine"></i>',
183
+
184
+ // Money & Commerce
185
+ '💰': '<i class="ph ph-money" aria-label="money"></i>',
186
+ '💵': '<i class="ph ph-currency-dollar" aria-label="dollar"></i>',
187
+ '💳': '<i class="ph ph-credit-card" aria-label="payment"></i>',
188
+ '🏦': '<i class="ph ph-bank" aria-label="bank"></i>',
189
+ '🛒': '<i class="ph ph-shopping-cart" aria-label="cart"></i>',
190
+ '🛍️': '<i class="ph ph-shopping-bag" aria-label="shopping"></i>',
191
+ '📦': '<i class="ph ph-package" aria-label="package"></i>',
192
+
193
+ // Symbols
194
+ '➕': '<i class="ph ph-plus" aria-label="add"></i>',
195
+ '➖': '<i class="ph ph-minus" aria-label="remove"></i>',
196
+ '✖️': '<i class="ph ph-x" aria-label="close"></i>',
197
+ '♻️': '<i class="ph ph-recycle" aria-label="recycle"></i>',
198
+ '❤️': '<i class="ph ph-heart" aria-label="love"></i>',
199
+ '💔': '<i class="ph ph-heart-break" aria-label="broken heart"></i>',
200
+ '⏭️': '<i class="ph ph-skip-forward" aria-label="next"></i>',
201
+ '⏮️': '<i class="ph ph-skip-back" aria-label="previous"></i>',
202
+ '⏸️': '<i class="ph ph-pause" aria-label="pause"></i>',
203
+ '▶️': '<i class="ph ph-play" aria-label="play"></i>',
204
+ '⏹️': '<i class="ph ph-stop" aria-label="stop"></i>',
205
+
206
+ // Special
207
+ '🌈': '<i class="ph ph-rainbow" aria-label="diversity"></i>',
208
+ '🦄': '<i class="ph ph-shooting-star" aria-label="unique"></i>',
209
+ '🎭': '<i class="ph ph-mask-happy" aria-label="theater"></i>',
210
+ '🎪': '<i class="ph ph-tent" aria-label="circus"></i>',
211
+ '🏳️': '<i class="ph ph-flag" aria-label="flag"></i>',
212
+ '🏴': '<i class="ph ph-flag" aria-label="flag"></i>',
213
+ '🏴‍☠️': '<i class="ph ph-skull" aria-label="danger"></i>',
214
+ };
215
+
216
+ /**
217
+ * Replace emojis with Phosphor icons in HTML
218
+ * @param {string} html - The HTML content to process
219
+ * @param {object} config - Configuration options
220
+ * @returns {string} - HTML with emojis replaced by icons
221
+ */
222
+ function replaceEmojisWithIcons(html, config = {}) {
223
+ // Check if feature is enabled
224
+ if (!config.features?.phosphorIcons) return html;
225
+
226
+ // Build regex pattern once with all emoji patterns
227
+ // Sort by length to match longer emojis first (e.g., ⚠️ before ⚠)
228
+ const emojiPattern = new RegExp(
229
+ Object.keys(emojiToPhosphor)
230
+ .sort((a, b) => b.length - a.length)
231
+ .map(emoji => emoji.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
232
+ .join('|'),
233
+ 'g'
234
+ );
235
+
236
+ // Get weight class if custom weight is specified
237
+ const weightClass = config.features.phosphorWeight && config.features.phosphorWeight !== 'regular'
238
+ ? `ph-${config.features.phosphorWeight}`
239
+ : 'ph';
240
+
241
+ // Apply size styling if configured
242
+ const sizeStyle = config.features.phosphorSize
243
+ ? ` style="font-size: ${config.features.phosphorSize}"`
244
+ : '';
245
+
246
+ return html.replace(emojiPattern, match => {
247
+ let iconHtml = emojiToPhosphor[match];
248
+ if (!iconHtml) return match;
249
+
250
+ // Update weight class if not regular
251
+ if (weightClass !== 'ph') {
252
+ iconHtml = iconHtml.replace('class="ph ', `class="${weightClass} `);
253
+ }
254
+
255
+ // Apply custom size if configured
256
+ if (sizeStyle) {
257
+ iconHtml = iconHtml.replace('<i class="', `<i${sizeStyle} class="`);
258
+ }
259
+
260
+ return iconHtml;
261
+ });
262
+ }
263
+
264
+ module.exports = {
265
+ emojiToPhosphor,
266
+ replaceEmojisWithIcons
267
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {