@seanyeh77/ui 0.48.2 → 0.49.0
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.
- package/dist/bundle.js +20 -20
- package/dist/components/FloorPlan/FloorPlan.d.ts +65 -0
- package/dist/components/FloorPlan/FloorPlan.js +822 -0
- package/dist/components/FloorPlan/FloorPlan.js.map +1 -0
- package/dist/components/InlineCode/InlineCode.js +41 -9
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.js +19 -6
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/ZoneMap/ZoneMap.d.ts +3 -0
- package/dist/components/ZoneMap/ZoneMap.js +6 -20
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
- package/dist/css/DataTable.css +1 -1
- package/dist/css/FloorPlan.css +270 -0
- package/dist/css/InlineCode.css +23 -0
- package/dist/css/ZoneMap.css +0 -97
- package/dist/css/base.css +99 -0
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/util.js +19 -1
- package/dist/internal/util.js.map +1 -1
- package/dist/internal/zone.js +48 -0
- package/dist/internal/zone.js.map +1 -0
- package/dist/styles.css +440 -151
- package/docs/DataColors.md +1 -1
- package/docs/FloorPlan.md +43 -0
- package/docs/InlineCode.md +1 -1
- package/docs/ZoneMap.md +2 -2
- package/docs/agents.md +5 -5
- package/docs/components.json +4 -0
- package/docs/data.md +2 -1
- package/docs/monitoring.md +7 -1
- package/package.json +2 -2
package/dist/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":[],"sources":["../src/i18n.ts"],"sourcesContent":["/* ---------- i18n and formats ----------\n Every built-in string is the zh-TW text passed through tr(); other languages come from UI.addMessages().\n Dates and numbers go through UI.format, which uses Intl for the current locale. The zh-TW rules are the\n ones the design system chose; other locales use their own conventions from Intl. */\ninterface I18nState {\n locale: string;\n currency: string;\n messages: Record<string, Record<string, string>>;\n}\n\nexport const I18N: I18nState = {\n locale: 'zh-TW',\n currency: 'TWD',\n messages: {\n en: {\n 'Email 或帳號': 'Email or username',\n '{n} 個百分點': '{n} pts',\n 上一頁: 'Previous page',\n 上個月: 'Previous month',\n '上傳失敗,請再試一次。': 'Upload failed. Try again.',\n 下一頁: 'Next page',\n 下個月: 'Next month',\n 主要導覽: 'Main navigation',\n 主題: 'Theme',\n 今天: 'Today',\n 全選: 'Select all',\n 全部: 'All',\n 全部標為已讀: 'Mark all as read',\n '共 {n} 筆': '{n} items',\n 分頁: 'Pagination',\n 刪除: 'Delete',\n 危險操作: 'Danger zone',\n 取消選取: 'Clear selection',\n '可以直接輸入,例如 2026/11/14': 'Type a date, e.g. 2026/11/14',\n 回上一頁: 'Go back',\n 回首頁: 'Go home',\n '完成 ✓': 'Done ✓',\n 密碼: 'Password',\n 展開側邊欄: 'Expand sidebar',\n '已選 {n} 筆': '{n} selected',\n '已選 {n} {unit}': '{n} selected',\n 帳號: 'Username',\n 強調色: 'Accent color',\n 忘記密碼: 'Forgot password',\n 找不到符合的選項: 'No matching options',\n '拖放檔案,或 ': 'Drop files here, or ',\n 搜尋: 'Search',\n 操作: 'Actions',\n 收合側邊欄: 'Collapse sidebar',\n 釘選側邊欄: 'Pin sidebar',\n 取消釘選: 'Unpin sidebar',\n 放棄: 'Discard',\n '放棄未儲存的變更?': 'Discard unsaved changes?',\n '{label}?': '{label}?',\n '{name} 上傳進度': 'Upload progress of {name}',\n 左右方向鍵查看每一項的數值: 'Use ← and → to read each value',\n 左右方向鍵查看每一個時間點的數值: 'Use ← and → to read each point',\n 左右方向鍵移動播放頭: 'Use ← and → to move the playhead',\n 現在: 'Now',\n 預測: 'Forecast',\n 回到現在: 'Back to now',\n 回放: 'Replay',\n 停止回放: 'Stop replay',\n 全螢幕: 'Full screen',\n 離開全螢幕: 'Exit full screen',\n 側欄: 'Side panel',\n 更多表格操作: 'More table actions',\n 還原預設: 'Restore defaults',\n 已還原預設的欄位與欄寬: 'Columns and widths restored to defaults',\n 套用的篩選: 'Applied filters',\n '移除篩選:{name}': 'Remove filter: {name}',\n '篩選,已套用 {n} 個條件': 'Filter, {n} conditions applied',\n '{name}:{value}': '{name}: {value}',\n 時間控制: 'Time control',\n 沒有事件: 'No events',\n 人工: 'Manual',\n 切換: 'Switch',\n 告警: 'Alert',\n '{v}({t})': '{v} ({t})',\n 這段時間沒有資料: 'No data for this period',\n 沒有資料: 'No data',\n 差: 'Difference',\n 正常: 'Normal',\n '⚠ 注意': '⚠ Watch',\n '⚠ 超過上限': '⚠ Over limit',\n '注意 {v}': 'Watch {v}',\n '上限 {v}': 'Limit {v}',\n '新增「{q}」': 'Add “{q}”',\n '日期格式不正確,請寫成 2026/11/14': 'Invalid date. Use 2026/11/14.',\n 更多操作: 'More actions',\n 更多: 'More',\n 左右滑動: 'Scroll sideways',\n 跳到主要內容: 'Skip to main content',\n 說明: 'Explain',\n 開啟導覽: 'Open navigation',\n 顯示方式: 'View',\n 顯示線上文字: 'Show line labels',\n 線上文字: 'Line labels',\n 圖: 'Diagram',\n 清單: 'List',\n 項目: 'Items',\n 關係: 'Relations',\n 已展開: 'Expanded',\n 已收合: 'Collapsed',\n '已展開,{n} 個子項目': 'Expanded, {n} items',\n '顯示 {n} {unit}': 'Showing {n} {unit}',\n 排序: 'Sort',\n '排序:{list}': 'Sort: {list}',\n 由小到大: 'ascending',\n 由大到小: 'descending',\n '依 {list} 排序': 'Sorted by {list}',\n ',再依 ': ', then by ',\n '、': ', ',\n 已還原原本的順序: 'Back to the original order',\n '{name},第 {n} 排序,{dir}': '{name}, sort level {n}, {dir}',\n '「{name}」第 {n} 排序;按 Alt+↑ ↓ 調整順序': '{name}, sort level {n}. Alt+Up or Down moves it',\n '「{name}」第 {n} 排序': '{name}, sort level {n}',\n '拖曳,或按 Alt+↑ ↓ 調整順序': 'Drag, or press Alt+Up or Alt+Down to reorder',\n '上移「{name}」': 'Move {name} up',\n '下移「{name}」': 'Move {name} down',\n '拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原': 'Drag or press Left and Right to resize; click to widen step by step, Enter to reset',\n '「{name}」欄寬 {n} px': '{name} column width {n} px',\n '已還原「{name}」欄寬': '{name} column width reset',\n '(改善)': ' (better)',\n '(變差)': ' (worse)',\n 長條圖: 'Bar chart',\n 折線圖: 'Line chart',\n 時間點: 'Time',\n 數值: 'Value',\n '數值({unit})': 'Value ({unit})',\n '{name}({unit})': '{name} ({unit})',\n '「{name}」的方向': 'Direction of {name}',\n '移除「{name}」排序': 'Remove the sort by {name}',\n '照資料原本的順序。': 'In the original order.',\n '再依…': 'Then by…',\n '排序依據…': 'Sort by…',\n 再依哪一欄: 'Then by which column',\n 依哪一欄排序: 'Sort by which column',\n '最多 {n} 層排序。': 'Up to {n} sort levels.',\n '找到 {n} 筆結果': '{n} results',\n '第 {a} 步,共 {b} 步': 'Step {a} of {b}',\n '說明 {name}': 'Explain {name}',\n 程式碼: 'Code',\n '第 {n} 行': 'Line {n}',\n '第 {n} 層': 'Level {n}',\n 第一行: 'First line',\n 最後一行: 'Last line',\n '上 20 行': '20 lines up',\n '下 20 行': '20 lines down',\n 上一段: 'Previous section',\n 下一段: 'Next section',\n '上一行/下一行': 'Previous / next line',\n '上一個/下一個連結': 'Previous / next link',\n '上一個/下一個名詞': 'Previous / next term',\n '上一個/下一個連結或名詞': 'Previous / next link or term',\n 回到這一行: 'Back to the line',\n 開啟: 'Open',\n '{name},第 {n} 行': '{name}, line {n}',\n '顯示 {n} 筆,另有 {m} 筆,請輸入更長的字': 'Showing {n}, {m} more: type more to narrow it down',\n '縮排 {n} 格': 'indented {n} spaces',\n '縮排 {n} 個 tab': 'indented {n} tabs',\n '縮排 {a} 個 tab、{b} 格': 'indented {a} tabs and {b} spaces',\n 向右捲動: 'Scroll right',\n 筆: 'rows',\n '1 筆': '1 row',\n // Separators: full-width in Chinese, ASCII and a space in English.\n ',': ', ',\n ':': ': ',\n '。': '. ',\n '來自 {from},{label}': 'From {from}, {label}',\n '{from} 到 {to},{what}': '{from} to {to}, {what}',\n 到: 'to',\n '{label}({inferred})': '{label} ({inferred})',\n 調整面板寬度: 'Resize the panel',\n 調整架構圖高度: 'Resize the diagram height',\n '調整「{name}」欄寬': 'Resize the column {name}',\n 放大表格: 'Enlarge the table',\n 表格: 'Table',\n '{n} px': '{n} px',\n '主要區域 {a} px,面板 {b} px': 'Main area {a} px, panel {b} px',\n '面板 {n} px': 'Panel {n} px',\n '拖曳或按 ← → 調整;按一下切換預設寬度,按兩下或 Enter 還原':\n 'Drag or press ← → to resize; click to step through preset widths; double-click or Enter to reset',\n '拖曳或按方向鍵調整;按一下切換預設大小,按兩下還原': 'Drag or press the arrow keys to resize; click to step through preset sizes; double-click to reset',\n '{label} {n} px': '{label} {n} px',\n '拖曳或按 ↑ ↓ 調整;按一下切換預設高度,按 Enter 還原': 'Drag or press ↑ ↓ to resize; click to step through preset heights; Enter to reset',\n '架構圖高度 {n} px': 'Diagram height {n} px',\n 外部: 'External',\n 詳細: 'Details',\n '展開 {name}': 'Expand {name}',\n '收合 {name}': 'Collapse {name}',\n 字: 'characters',\n 'C 語言': 'C',\n 程式語言: 'Language',\n 全部頁面: 'All pages',\n '最近 30 天': 'Last 30 days',\n '最近 7 天': 'Last 7 days',\n 期間: 'Period',\n 未讀: 'Unread',\n 本月: 'This month',\n 沒有符合的資料: 'No matching data',\n 沒有通知: 'No notifications',\n 清除: 'Clear',\n 清除搜尋: 'Clear search',\n 登入: 'Sign in',\n 發生錯誤: 'Something went wrong',\n '移除 {name}': 'Remove {name}',\n '已移除 {name}': 'Removed {name}',\n '清除{name}': 'Clear {name}',\n '已清除{name}': 'Cleared {name}',\n '第 {a}–{b} {unit},共 {n} {unit}': '{a}–{b} of {n}',\n 繼續編輯: 'Keep editing',\n '自訂強調色(色碼)': 'Custom accent color (hex)',\n '已達 {n} 字上限': 'Reached the {n}-character limit',\n '另外 {n} 個:{list}': '{n} more: {list}',\n 關閉通知: 'Close notification',\n '色碼格式不正確,請輸入 # 加 6 碼,例如 #2457d6': 'Not a color code. Type # and 6 digits, e.g. #2457d6',\n '色碼格式不正確,例如 #2457d6': 'Invalid hex, e.g. #2457d6',\n 設定分類: 'Settings sections',\n 請輸入密碼: 'Enter your password',\n 請輸入帳號: 'Enter your username',\n 請選擇: 'Select',\n 路徑: 'Breadcrumb',\n 較上週: 'vs last week',\n 載入中: 'Loading',\n '輸入 # 加 6 碼': 'Enter # and 6 digits',\n 通知: 'Notifications',\n '通知,{n} 則未讀': 'Notifications, {n} unread',\n 通知中心: 'Notifications',\n '通知中心,{n} 則未讀': 'Notifications, {n} unread',\n '選取第 {n} 筆': 'Select row {n}',\n 選擇日期: 'Choose date',\n 選擇期間: 'Choose period',\n 選擇檔案: 'choose files',\n 重試: 'Retry',\n 開啟日曆: 'Open calendar',\n 關閉: 'Close',\n '關閉後,剛才的修改不會保留。': 'If you close now, your changes will be lost.',\n 關閉提示: 'Dismiss',\n 鍵盤操作: 'Keyboard',\n 顯示或關閉這份說明: 'Show or hide this list',\n // Workbench region names: the plain key is the standalone form (a label, the start of a sentence); 「句中::」\n // is the form inside a sentence, after 「the」. Proper names keep their capital there, common nouns do not.\n 檔案總管: 'Explorer',\n 右側欄: 'Side bar',\n 下方面板: 'Panel',\n '句中::檔案總管': 'Explorer',\n '句中::右側欄': 'side bar',\n '句中::下方面板': 'panel',\n 有新內容: 'New content',\n '更多分頁({n} 個)': 'More tabs ({n})',\n '更多 {n}': '{n} more',\n 位置不變: 'Same place',\n 放開以排在這裡: 'Drop to place it here',\n '放開以移到{region}': 'Drop to move to the {region}',\n '把目前分頁移到{region}': 'Move this tab to the {region}',\n '收合{region}': 'Hide the {region}',\n '關閉{region}': 'Close the {region}',\n '{region}寬度': '{region} width',\n '{region}高度': '{region} height',\n 面板高度: 'Panel height',\n 面板分頁: 'Panel tabs',\n 目前分頁往左移: 'Move this tab left',\n 目前分頁往右移: 'Move this tab right',\n 收起面板: 'Hide the panel',\n 編輯器: 'Editor',\n 開始: 'Start',\n 'AI 說明': 'AI note',\n 'AI 撰寫': 'AI-written',\n '({v})': ' ({v})',\n 隱藏密碼: 'Hide password',\n 顯示密碼: 'Show password',\n '(今天)': ' (today)',\n 伺服器暫時無法回應: 'The server is not responding',\n 找不到這個頁面: 'Page not found',\n 沒有權限查看這個頁面: 'You do not have access to this page',\n '網址可能打錯了,或這個頁面已經移除。': 'The address may be wrong, or the page has been removed.',\n '這個問題已經記錄下來,請稍後重新整理再試。': 'The problem has been logged. Refresh the page later.',\n '請向管理員申請權限,或切換成有權限的帳號。': 'Ask an admin for access, or switch to an account that has it.',\n 自動: 'Auto',\n 淺色: 'Light',\n 深色: 'Dark',\n 藍: 'Blue',\n 靛: 'Indigo',\n 紫: 'Purple',\n 桃紅: 'Pink',\n 紅: 'Red',\n 橘: 'Orange',\n 綠: 'Green',\n 青: 'Teal',\n 草稿: 'Draft',\n 進行中: 'In progress',\n 審核中: 'In review',\n 完成: 'Done',\n 失敗: 'Failed',\n 已關閉: 'Closed',\n 已暫停: 'Paused',\n 在線: 'Online',\n '(在新分頁開啟)': ' (opens in a new tab)',\n '{lang} 程式碼': '{lang} code',\n 檢視: 'Views',\n '{n} {unit}': '{n} {unit}',\n '{n} / {total} {unit}': '{n} / {total} {unit}',\n '{n} / {total}': '{n} / {total}',\n '{total} {unit}中的 {n} {unit}': '{n} of {total} {unit}',\n '{total} 中的 {n}': '{n} of {total}',\n 欄位: 'Columns',\n 顯示的欄位: 'Visible columns',\n 清除篩選: 'Clear filters',\n 清除全部: 'Clear all',\n 篩選: 'Filter',\n 最低: 'Min',\n 最高: 'Max',\n '合計 {n} {unit}': 'Total: {n}',\n 平均: 'Avg',\n '選取 {name}': 'Select {name}',\n '{n} 個新': '{n} new',\n '{n} 個檔案': '{n} files',\n '下載 {name}': 'Download {name}',\n '已選 {n} 個檔案': '{n} files selected',\n '共 {size}': '{size} total',\n 清除選取: 'Clear selection',\n 下載: 'Download',\n 全部展開: 'Expand all',\n 全部收合: 'Collapse all',\n 這裡還沒有檔案: 'No files here yet',\n 顯示全部: 'Show all',\n 收合: 'Collapse',\n '清單::收合': 'Show less',\n 依狀態篩選: 'Filter by status',\n 展開: 'Expand',\n 沒有項目: 'Nothing here',\n 即時: 'Live',\n 已過期: 'Stale',\n 離線: 'Offline',\n 切換專案: 'Switch project',\n '切換專案,目前是 {name}': 'Switch project, now {name}',\n 推測: 'Inferred',\n '{n} 個項目': '{n} items',\n '1 個項目': '1 item',\n '{a} 個項目使用,共 {b} 次': 'Used {b} times by {a} items',\n 共用項目: 'Shared',\n 次數越多線越粗: 'Thicker lines mean more often',\n 架構圖: 'Architecture',\n '{n} 次': '{n} uses',\n '1 次': '1 use',\n '使用 {n} 次': 'Used {n} times',\n 編號的線: 'Numbered lines',\n '複製成 Markdown': 'Copy as Markdown',\n '快選::上個月': 'Last month',\n 頁面: 'Page',\n 設定: 'Setting',\n 指令: 'Command',\n 檔案: 'File',\n 原始碼: 'Source',\n '顯示全部 {n} 行': 'Show all {n} lines',\n '只顯示第 {n} 行前後': 'Show only around line {n}',\n '無法載入 {name} 的子項目': 'Could not load the children of {name}',\n '找不到符合「{q}」的結果': 'No results for “{q}”',\n 輸入名稱開始搜尋: 'Type a name to search',\n 搜尋中: 'Searching',\n 搜尋結果: 'Search results',\n 最近開啟: 'Recently opened',\n 選擇: 'Select',\n 打開: 'Open',\n 取消: 'Cancel',\n 略過: 'Skip',\n 上一步: 'Back',\n 下一步: 'Next',\n 建議修正: 'Suggested fix',\n 複製修正: 'Copy fix',\n 已複製: 'Copied',\n 複製程式碼: 'Copy code',\n '原本:': 'Before: ',\n '改成:': 'After: ',\n 關閉說明: 'Close explanation',\n ',有說明': ', has an explanation',\n '(說明)': ' (explain)',\n '搜尋({k})': 'Search ({k})',\n 確定的關係: 'Confirmed',\n 推測的關係: 'Inferred',\n 專案宣告的關係: 'Declared by the project',\n 宣告: 'Declared',\n 外部項目: 'External',\n },\n },\n};\n\nfunction msgsFor(loc: string): Record<string, string> | null {\n return I18N.messages[loc] || I18N.messages[loc.split('-')[0]] || null;\n}\n\n/** Translates a built-in zh-TW string into the current locale; {name} placeholders take vars. A key may start with a\n * context and 「::」 ('快選::上個月'): only the text after it is shown in zh-TW. */\nexport function tr(key: string, vars?: Record<string, string | number>): string {\n // zh-TW (and zh-Hant) is the source text; other Chinese locales (zh-CN) use the messages an app adds for them.\n const m = isZhTW() ? null : msgsFor(I18N.locale);\n // A context before 「::」 tells apart one word with two meanings ('快選::上個月' is Last month, '上個月' Previous\n // month); zh-TW shows the text after it, and a locale without the context key uses the plain one.\n const at = key.indexOf('::');\n const text = at >= 0 ? key.slice(at + 2) : key;\n const out = m?.[key] ?? (at >= 0 ? m?.[text] : undefined) ?? text;\n return vars ? out.replace(/\\{(\\w+)\\}/g, (a, k: string) => (vars[k] !== undefined ? String(vars[k]) : a)) : out;\n}\n\n/** A count's unit: a function gets the count (for plurals, 「1 row」「2 rows」); a string goes through tr(), and for 1\n * the message 「1 <unit>」 is used when the locale has one (「1 筆」 → 「1 row」), without the number. */\nexport type CountUnit = string | ((n: number) => string);\nexport function unitFor(unit: CountUnit | undefined, n: number): string {\n if (!unit) return '';\n if (typeof unit === 'function') return unit(n);\n if (n === 1) {\n const one = tr('1 ' + unit);\n if (one !== '1 ' + unit) return one.replace(/^1\\s*/, '');\n }\n return tr(unit);\n}\n\nconst localeListeners = new Set<() => void>();\n\n/** Calls f after every change of locale or currency (setLocale) and of messages (addMessages); returns the unsubscribe.\n * useLocale() is built on it. */\nexport function subscribeLocale(f: () => void): () => void {\n localeListeners.add(f);\n return () => {\n localeListeners.delete(f);\n };\n}\n\n/** Switches the interface language and, optionally, the currency used by format.money. Components that read the\n * locale with useLocale() (and their children) render again. */\nexport function setLocale(locale: string, opts?: { currency?: string }): void {\n const next = locale || 'zh-TW';\n const changed = next !== I18N.locale || (!!opts?.currency && opts.currency !== I18N.currency);\n I18N.locale = next;\n if (opts?.currency) I18N.currency = opts.currency;\n if (typeof document !== 'undefined') document.documentElement.setAttribute('lang', I18N.locale);\n if (changed) emitLocale();\n}\n\n/** Tells the subscribers that the locale changed (LocaleProvider, after it set the locale while rendering). */\nexport function emitLocale(): void {\n localeListeners.forEach((f) => f());\n}\n\n/** Adds or overrides translations for a locale. Keys are the zh-TW strings. */\nexport function addMessages(locale: string, dict: Record<string, string>): void {\n I18N.messages[locale] = { ...I18N.messages[locale], ...dict };\n emitLocale();\n}\n\nexport const isZhTW = (): boolean => /^zh-(TW|Hant)/i.test(I18N.locale);\n"],"mappings":";AAUA,MAAa,OAAkB;CAC7B,QAAQ;CACR,UAAU;CACV,UAAU,EACR,IAAI;EACF,aAAa;EACb,YAAY;EACZ,KAAK;EACL,KAAK;EACL,eAAe;EACf,KAAK;EACL,KAAK;EACL,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,WAAW;EACX,IAAI;EACJ,IAAI;EACJ,MAAM;EACN,MAAM;EACN,wBAAwB;EACxB,MAAM;EACN,KAAK;EACL,QAAQ;EACR,IAAI;EACJ,OAAO;EACP,YAAY;EACZ,iBAAiB;EACjB,IAAI;EACJ,KAAK;EACL,MAAM;EACN,UAAU;EACV,WAAW;EACX,IAAI;EACJ,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,IAAI;EACJ,aAAa;EACb,YAAY;EACZ,eAAe;EACf,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,IAAI;EACJ,IAAI;EACJ,MAAM;EACN,IAAI;EACJ,MAAM;EACN,KAAK;EACL,OAAO;EACP,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,aAAa;EACb,OAAO;EACP,eAAe;EACf,kBAAkB;EAClB,kBAAkB;EAClB,MAAM;EACN,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,YAAY;EACZ,UAAU;EACV,MAAM;EACN,GAAG;EACH,IAAI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AAK,MAAM"}
|
|
1
|
+
{"version":3,"file":"i18n.js","names":[],"sources":["../src/i18n.ts"],"sourcesContent":["/* ---------- i18n and formats ----------\n Every built-in string is the zh-TW text passed through tr(); other languages come from UI.addMessages().\n Dates and numbers go through UI.format, which uses Intl for the current locale. The zh-TW rules are the\n ones the design system chose; other locales use their own conventions from Intl. */\ninterface I18nState {\n locale: string;\n currency: string;\n messages: Record<string, Record<string, string>>;\n}\n\nexport const I18N: I18nState = {\n locale: 'zh-TW',\n currency: 'TWD',\n messages: {\n en: {\n 'Email 或帳號': 'Email or username',\n '{n} 個百分點': '{n} pts',\n 上一頁: 'Previous page',\n 上個月: 'Previous month',\n '上傳失敗,請再試一次。': 'Upload failed. Try again.',\n 下一頁: 'Next page',\n 下個月: 'Next month',\n 主要導覽: 'Main navigation',\n 主題: 'Theme',\n 今天: 'Today',\n 全選: 'Select all',\n 全部: 'All',\n 全部標為已讀: 'Mark all as read',\n '共 {n} 筆': '{n} items',\n 分頁: 'Pagination',\n 刪除: 'Delete',\n 危險操作: 'Danger zone',\n 取消選取: 'Clear selection',\n '可以直接輸入,例如 2026/11/14': 'Type a date, e.g. 2026/11/14',\n 回上一頁: 'Go back',\n 回首頁: 'Go home',\n '完成 ✓': 'Done ✓',\n 密碼: 'Password',\n 展開側邊欄: 'Expand sidebar',\n '已選 {n} 筆': '{n} selected',\n '已選 {n} {unit}': '{n} selected',\n 帳號: 'Username',\n 強調色: 'Accent color',\n 忘記密碼: 'Forgot password',\n 找不到符合的選項: 'No matching options',\n '拖放檔案,或 ': 'Drop files here, or ',\n 搜尋: 'Search',\n 操作: 'Actions',\n 收合側邊欄: 'Collapse sidebar',\n 釘選側邊欄: 'Pin sidebar',\n 取消釘選: 'Unpin sidebar',\n 放棄: 'Discard',\n '放棄未儲存的變更?': 'Discard unsaved changes?',\n '{label}?': '{label}?',\n '{name} 上傳進度': 'Upload progress of {name}',\n 左右方向鍵查看每一項的數值: 'Use ← and → to read each value',\n 左右方向鍵查看每一個時間點的數值: 'Use ← and → to read each point',\n 左右方向鍵移動播放頭: 'Use ← and → to move the playhead',\n 現在: 'Now',\n 預測: 'Forecast',\n 回到現在: 'Back to now',\n 回放: 'Replay',\n 停止回放: 'Stop replay',\n 全螢幕: 'Full screen',\n 離開全螢幕: 'Exit full screen',\n 側欄: 'Side panel',\n 更多表格操作: 'More table actions',\n 還原預設: 'Restore defaults',\n 已還原預設的欄位與欄寬: 'Columns and widths restored to defaults',\n 套用的篩選: 'Applied filters',\n '移除篩選:{name}': 'Remove filter: {name}',\n '篩選,已套用 {n} 個條件': 'Filter, {n} conditions applied',\n '{name}:{value}': '{name}: {value}',\n 時間控制: 'Time control',\n 沒有事件: 'No events',\n 人工: 'Manual',\n 切換: 'Switch',\n 告警: 'Alert',\n '{v}({t})': '{v} ({t})',\n 這段時間沒有資料: 'No data for this period',\n 沒有資料: 'No data',\n 差: 'Difference',\n 正常: 'Normal',\n '⚠ 注意': '⚠ Watch',\n '⚠ 超過上限': '⚠ Over limit',\n '注意 {v}': 'Watch {v}',\n '上限 {v}': 'Limit {v}',\n 放大: 'Zoom in',\n 縮小: 'Zoom out',\n 重設視角: 'Reset view',\n 次要: 'Secondary',\n '淡色=次要區域': 'Faded: secondary zone',\n '+ − 縮放,方向鍵平移': '+ − zoom, arrow keys pan',\n '新增「{q}」': 'Add “{q}”',\n '日期格式不正確,請寫成 2026/11/14': 'Invalid date. Use 2026/11/14.',\n 更多操作: 'More actions',\n 更多: 'More',\n 左右滑動: 'Scroll sideways',\n 跳到主要內容: 'Skip to main content',\n 說明: 'Explain',\n 開啟導覽: 'Open navigation',\n 顯示方式: 'View',\n 顯示線上文字: 'Show line labels',\n 線上文字: 'Line labels',\n 圖: 'Diagram',\n 清單: 'List',\n 項目: 'Items',\n 關係: 'Relations',\n 已展開: 'Expanded',\n 已收合: 'Collapsed',\n '已展開,{n} 個子項目': 'Expanded, {n} items',\n '顯示 {n} {unit}': 'Showing {n} {unit}',\n 排序: 'Sort',\n '排序:{list}': 'Sort: {list}',\n 由小到大: 'ascending',\n 由大到小: 'descending',\n '依 {list} 排序': 'Sorted by {list}',\n ',再依 ': ', then by ',\n '、': ', ',\n 已還原原本的順序: 'Back to the original order',\n '{name},第 {n} 排序,{dir}': '{name}, sort level {n}, {dir}',\n '「{name}」第 {n} 排序;按 Alt+↑ ↓ 調整順序': '{name}, sort level {n}. Alt+Up or Down moves it',\n '「{name}」第 {n} 排序': '{name}, sort level {n}',\n '拖曳,或按 Alt+↑ ↓ 調整順序': 'Drag, or press Alt+Up or Alt+Down to reorder',\n '上移「{name}」': 'Move {name} up',\n '下移「{name}」': 'Move {name} down',\n '拖曳或按 ← → 調整;按一下依序加寬,按 Enter 還原': 'Drag or press Left and Right to resize; click to widen step by step, Enter to reset',\n '「{name}」欄寬 {n} px': '{name} column width {n} px',\n '已還原「{name}」欄寬': '{name} column width reset',\n '(改善)': ' (better)',\n '(變差)': ' (worse)',\n 長條圖: 'Bar chart',\n 折線圖: 'Line chart',\n 時間點: 'Time',\n 數值: 'Value',\n '數值({unit})': 'Value ({unit})',\n '{name}({unit})': '{name} ({unit})',\n '「{name}」的方向': 'Direction of {name}',\n '移除「{name}」排序': 'Remove the sort by {name}',\n '照資料原本的順序。': 'In the original order.',\n '再依…': 'Then by…',\n '排序依據…': 'Sort by…',\n 再依哪一欄: 'Then by which column',\n 依哪一欄排序: 'Sort by which column',\n '最多 {n} 層排序。': 'Up to {n} sort levels.',\n '找到 {n} 筆結果': '{n} results',\n '第 {a} 步,共 {b} 步': 'Step {a} of {b}',\n '說明 {name}': 'Explain {name}',\n 程式碼: 'Code',\n '第 {n} 行': 'Line {n}',\n '第 {n} 層': 'Level {n}',\n 第一行: 'First line',\n 最後一行: 'Last line',\n '上 20 行': '20 lines up',\n '下 20 行': '20 lines down',\n 上一段: 'Previous section',\n 下一段: 'Next section',\n '上一行/下一行': 'Previous / next line',\n '上一個/下一個連結': 'Previous / next link',\n '上一個/下一個名詞': 'Previous / next term',\n '上一個/下一個連結或名詞': 'Previous / next link or term',\n 回到這一行: 'Back to the line',\n 開啟: 'Open',\n '{name},第 {n} 行': '{name}, line {n}',\n '顯示 {n} 筆,另有 {m} 筆,請輸入更長的字': 'Showing {n}, {m} more: type more to narrow it down',\n '縮排 {n} 格': 'indented {n} spaces',\n '縮排 {n} 個 tab': 'indented {n} tabs',\n '縮排 {a} 個 tab、{b} 格': 'indented {a} tabs and {b} spaces',\n 向右捲動: 'Scroll right',\n 筆: 'rows',\n '1 筆': '1 row',\n // Separators: full-width in Chinese, ASCII and a space in English.\n ',': ', ',\n ':': ': ',\n '。': '. ',\n '來自 {from},{label}': 'From {from}, {label}',\n '{from} 到 {to},{what}': '{from} to {to}, {what}',\n 到: 'to',\n '{label}({inferred})': '{label} ({inferred})',\n 調整面板寬度: 'Resize the panel',\n 調整架構圖高度: 'Resize the diagram height',\n '調整「{name}」欄寬': 'Resize the column {name}',\n 放大表格: 'Enlarge the table',\n 表格: 'Table',\n '{n} px': '{n} px',\n '主要區域 {a} px,面板 {b} px': 'Main area {a} px, panel {b} px',\n '面板 {n} px': 'Panel {n} px',\n '拖曳或按 ← → 調整;按一下切換預設寬度,按兩下或 Enter 還原':\n 'Drag or press ← → to resize; click to step through preset widths; double-click or Enter to reset',\n '拖曳或按方向鍵調整;按一下切換預設大小,按兩下還原': 'Drag or press the arrow keys to resize; click to step through preset sizes; double-click to reset',\n '{label} {n} px': '{label} {n} px',\n '拖曳或按 ↑ ↓ 調整;按一下切換預設高度,按 Enter 還原': 'Drag or press ↑ ↓ to resize; click to step through preset heights; Enter to reset',\n '架構圖高度 {n} px': 'Diagram height {n} px',\n 外部: 'External',\n 詳細: 'Details',\n '展開 {name}': 'Expand {name}',\n '收合 {name}': 'Collapse {name}',\n 字: 'characters',\n 'C 語言': 'C',\n 程式語言: 'Language',\n 全部頁面: 'All pages',\n '最近 30 天': 'Last 30 days',\n '最近 7 天': 'Last 7 days',\n 期間: 'Period',\n 未讀: 'Unread',\n 本月: 'This month',\n 沒有符合的資料: 'No matching data',\n 沒有通知: 'No notifications',\n 清除: 'Clear',\n 清除搜尋: 'Clear search',\n 登入: 'Sign in',\n 發生錯誤: 'Something went wrong',\n '移除 {name}': 'Remove {name}',\n '已移除 {name}': 'Removed {name}',\n '清除{name}': 'Clear {name}',\n '已清除{name}': 'Cleared {name}',\n '第 {a}–{b} {unit},共 {n} {unit}': '{a}–{b} of {n}',\n 繼續編輯: 'Keep editing',\n '自訂強調色(色碼)': 'Custom accent color (hex)',\n '已達 {n} 字上限': 'Reached the {n}-character limit',\n '另外 {n} 個:{list}': '{n} more: {list}',\n 關閉通知: 'Close notification',\n '色碼格式不正確,請輸入 # 加 6 碼,例如 #2457d6': 'Not a color code. Type # and 6 digits, e.g. #2457d6',\n '色碼格式不正確,例如 #2457d6': 'Invalid hex, e.g. #2457d6',\n 設定分類: 'Settings sections',\n 請輸入密碼: 'Enter your password',\n 請輸入帳號: 'Enter your username',\n 請選擇: 'Select',\n 路徑: 'Breadcrumb',\n 較上週: 'vs last week',\n 載入中: 'Loading',\n '輸入 # 加 6 碼': 'Enter # and 6 digits',\n 通知: 'Notifications',\n '通知,{n} 則未讀': 'Notifications, {n} unread',\n 通知中心: 'Notifications',\n '通知中心,{n} 則未讀': 'Notifications, {n} unread',\n '選取第 {n} 筆': 'Select row {n}',\n 選擇日期: 'Choose date',\n 選擇期間: 'Choose period',\n 選擇檔案: 'choose files',\n 重試: 'Retry',\n 開啟日曆: 'Open calendar',\n 關閉: 'Close',\n '關閉後,剛才的修改不會保留。': 'If you close now, your changes will be lost.',\n 關閉提示: 'Dismiss',\n 鍵盤操作: 'Keyboard',\n 顯示或關閉這份說明: 'Show or hide this list',\n // Workbench region names: the plain key is the standalone form (a label, the start of a sentence); 「句中::」\n // is the form inside a sentence, after 「the」. Proper names keep their capital there, common nouns do not.\n 檔案總管: 'Explorer',\n 右側欄: 'Side bar',\n 下方面板: 'Panel',\n '句中::檔案總管': 'Explorer',\n '句中::右側欄': 'side bar',\n '句中::下方面板': 'panel',\n 有新內容: 'New content',\n '更多分頁({n} 個)': 'More tabs ({n})',\n '更多 {n}': '{n} more',\n 位置不變: 'Same place',\n 放開以排在這裡: 'Drop to place it here',\n '放開以移到{region}': 'Drop to move to the {region}',\n '把目前分頁移到{region}': 'Move this tab to the {region}',\n '收合{region}': 'Hide the {region}',\n '關閉{region}': 'Close the {region}',\n '{region}寬度': '{region} width',\n '{region}高度': '{region} height',\n 面板高度: 'Panel height',\n 面板分頁: 'Panel tabs',\n 目前分頁往左移: 'Move this tab left',\n 目前分頁往右移: 'Move this tab right',\n 收起面板: 'Hide the panel',\n 編輯器: 'Editor',\n 開始: 'Start',\n 'AI 說明': 'AI note',\n 'AI 撰寫': 'AI-written',\n '({v})': ' ({v})',\n 隱藏密碼: 'Hide password',\n 顯示密碼: 'Show password',\n '(今天)': ' (today)',\n 伺服器暫時無法回應: 'The server is not responding',\n 找不到這個頁面: 'Page not found',\n 沒有權限查看這個頁面: 'You do not have access to this page',\n '網址可能打錯了,或這個頁面已經移除。': 'The address may be wrong, or the page has been removed.',\n '這個問題已經記錄下來,請稍後重新整理再試。': 'The problem has been logged. Refresh the page later.',\n '請向管理員申請權限,或切換成有權限的帳號。': 'Ask an admin for access, or switch to an account that has it.',\n 自動: 'Auto',\n 淺色: 'Light',\n 深色: 'Dark',\n 藍: 'Blue',\n 靛: 'Indigo',\n 紫: 'Purple',\n 桃紅: 'Pink',\n 紅: 'Red',\n 橘: 'Orange',\n 綠: 'Green',\n 青: 'Teal',\n 草稿: 'Draft',\n 進行中: 'In progress',\n 審核中: 'In review',\n 完成: 'Done',\n 失敗: 'Failed',\n 已關閉: 'Closed',\n 已暫停: 'Paused',\n 在線: 'Online',\n '(在新分頁開啟)': ' (opens in a new tab)',\n '{lang} 程式碼': '{lang} code',\n 檢視: 'Views',\n '{n} {unit}': '{n} {unit}',\n '{n} / {total} {unit}': '{n} / {total} {unit}',\n '{n} / {total}': '{n} / {total}',\n '{total} {unit}中的 {n} {unit}': '{n} of {total} {unit}',\n '{total} 中的 {n}': '{n} of {total}',\n 欄位: 'Columns',\n 顯示的欄位: 'Visible columns',\n 清除篩選: 'Clear filters',\n 清除全部: 'Clear all',\n 篩選: 'Filter',\n 最低: 'Min',\n 最高: 'Max',\n '合計 {n} {unit}': 'Total: {n}',\n 平均: 'Avg',\n '選取 {name}': 'Select {name}',\n '{n} 個新': '{n} new',\n '{n} 個檔案': '{n} files',\n '下載 {name}': 'Download {name}',\n '已選 {n} 個檔案': '{n} files selected',\n '共 {size}': '{size} total',\n 清除選取: 'Clear selection',\n 下載: 'Download',\n 全部展開: 'Expand all',\n 全部收合: 'Collapse all',\n 這裡還沒有檔案: 'No files here yet',\n 顯示全部: 'Show all',\n 收合: 'Collapse',\n '清單::收合': 'Show less',\n 依狀態篩選: 'Filter by status',\n 展開: 'Expand',\n 沒有項目: 'Nothing here',\n 即時: 'Live',\n 已過期: 'Stale',\n 離線: 'Offline',\n 切換專案: 'Switch project',\n '切換專案,目前是 {name}': 'Switch project, now {name}',\n 推測: 'Inferred',\n '{n} 個項目': '{n} items',\n '1 個項目': '1 item',\n '{a} 個項目使用,共 {b} 次': 'Used {b} times by {a} items',\n 共用項目: 'Shared',\n 次數越多線越粗: 'Thicker lines mean more often',\n 架構圖: 'Architecture',\n '{n} 次': '{n} uses',\n '1 次': '1 use',\n '使用 {n} 次': 'Used {n} times',\n 編號的線: 'Numbered lines',\n '複製成 Markdown': 'Copy as Markdown',\n '快選::上個月': 'Last month',\n 頁面: 'Page',\n 設定: 'Setting',\n 指令: 'Command',\n 檔案: 'File',\n 原始碼: 'Source',\n '顯示全部 {n} 行': 'Show all {n} lines',\n '只顯示第 {n} 行前後': 'Show only around line {n}',\n '無法載入 {name} 的子項目': 'Could not load the children of {name}',\n '找不到符合「{q}」的結果': 'No results for “{q}”',\n 輸入名稱開始搜尋: 'Type a name to search',\n 搜尋中: 'Searching',\n 搜尋結果: 'Search results',\n 最近開啟: 'Recently opened',\n 選擇: 'Select',\n 打開: 'Open',\n 取消: 'Cancel',\n 略過: 'Skip',\n 上一步: 'Back',\n 下一步: 'Next',\n 建議修正: 'Suggested fix',\n 複製修正: 'Copy fix',\n 已複製: 'Copied',\n 複製程式碼: 'Copy code',\n '原本:': 'Before: ',\n '改成:': 'After: ',\n 關閉說明: 'Close explanation',\n ',有說明': ', has an explanation',\n '(說明)': ' (explain)',\n '搜尋({k})': 'Search ({k})',\n 確定的關係: 'Confirmed',\n 推測的關係: 'Inferred',\n 專案宣告的關係: 'Declared by the project',\n 宣告: 'Declared',\n 外部項目: 'External',\n },\n },\n};\n\nfunction msgsFor(loc: string): Record<string, string> | null {\n return I18N.messages[loc] || I18N.messages[loc.split('-')[0]] || null;\n}\n\n/** Translates a built-in zh-TW string into the current locale; {name} placeholders take vars. A key may start with a\n * context and 「::」 ('快選::上個月'): only the text after it is shown in zh-TW. */\nexport function tr(key: string, vars?: Record<string, string | number>): string {\n // zh-TW (and zh-Hant) is the source text; other Chinese locales (zh-CN) use the messages an app adds for them.\n const m = isZhTW() ? null : msgsFor(I18N.locale);\n // A context before 「::」 tells apart one word with two meanings ('快選::上個月' is Last month, '上個月' Previous\n // month); zh-TW shows the text after it, and a locale without the context key uses the plain one.\n const at = key.indexOf('::');\n const text = at >= 0 ? key.slice(at + 2) : key;\n const out = m?.[key] ?? (at >= 0 ? m?.[text] : undefined) ?? text;\n return vars ? out.replace(/\\{(\\w+)\\}/g, (a, k: string) => (vars[k] !== undefined ? String(vars[k]) : a)) : out;\n}\n\n/** A count's unit: a function gets the count (for plurals, 「1 row」「2 rows」); a string goes through tr(), and for 1\n * the message 「1 <unit>」 is used when the locale has one (「1 筆」 → 「1 row」), without the number. */\nexport type CountUnit = string | ((n: number) => string);\nexport function unitFor(unit: CountUnit | undefined, n: number): string {\n if (!unit) return '';\n if (typeof unit === 'function') return unit(n);\n if (n === 1) {\n const one = tr('1 ' + unit);\n if (one !== '1 ' + unit) return one.replace(/^1\\s*/, '');\n }\n return tr(unit);\n}\n\nconst localeListeners = new Set<() => void>();\n\n/** Calls f after every change of locale or currency (setLocale) and of messages (addMessages); returns the unsubscribe.\n * useLocale() is built on it. */\nexport function subscribeLocale(f: () => void): () => void {\n localeListeners.add(f);\n return () => {\n localeListeners.delete(f);\n };\n}\n\n/** Switches the interface language and, optionally, the currency used by format.money. Components that read the\n * locale with useLocale() (and their children) render again. */\nexport function setLocale(locale: string, opts?: { currency?: string }): void {\n const next = locale || 'zh-TW';\n const changed = next !== I18N.locale || (!!opts?.currency && opts.currency !== I18N.currency);\n I18N.locale = next;\n if (opts?.currency) I18N.currency = opts.currency;\n if (typeof document !== 'undefined') document.documentElement.setAttribute('lang', I18N.locale);\n if (changed) emitLocale();\n}\n\n/** Tells the subscribers that the locale changed (LocaleProvider, after it set the locale while rendering). */\nexport function emitLocale(): void {\n localeListeners.forEach((f) => f());\n}\n\n/** Adds or overrides translations for a locale. Keys are the zh-TW strings. */\nexport function addMessages(locale: string, dict: Record<string, string>): void {\n I18N.messages[locale] = { ...I18N.messages[locale], ...dict };\n emitLocale();\n}\n\nexport const isZhTW = (): boolean => /^zh-(TW|Hant)/i.test(I18N.locale);\n"],"mappings":";AAUA,MAAa,OAAkB;CAC7B,QAAQ;CACR,UAAU;CACV,UAAU,EACR,IAAI;EACF,aAAa;EACb,YAAY;EACZ,KAAK;EACL,KAAK;EACL,eAAe;EACf,KAAK;EACL,KAAK;EACL,MAAM;EACN,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,WAAW;EACX,IAAI;EACJ,IAAI;EACJ,MAAM;EACN,MAAM;EACN,wBAAwB;EACxB,MAAM;EACN,KAAK;EACL,QAAQ;EACR,IAAI;EACJ,OAAO;EACP,YAAY;EACZ,iBAAiB;EACjB,IAAI;EACJ,KAAK;EACL,MAAM;EACN,UAAU;EACV,WAAW;EACX,IAAI;EACJ,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,IAAI;EACJ,aAAa;EAC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AAC,MAAM,YAAY,KAAK,aAAa,KAAK;CACpF,KAAK,SAAS;CACd,IAAI,MAAM,UAAU,KAAK,WAAW,KAAK;CACzC,IAAI,OAAO,aAAa,aAAa,SAAS,gBAAgB,aAAa,QAAQ,KAAK,MAAM;CAC9F,IAAI,SAAS,WAAW;AAC1B;;AAGA,SAAgB,aAAmB;CACjC,gBAAgB,SAAS,MAAM,EAAE,CAAC;AACpC;;AAGA,SAAgB,YAAY,QAAgB,MAAoC;CAC9E,KAAK,SAAS,UAAU;EAAE,GAAG,KAAK,SAAS;EAAS,GAAG;CAAK;CAC5D,WAAW;AACb;AAEA,MAAa,eAAwB,iBAAiB,KAAK,KAAK,MAAM"}
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ import { LineBand, LineChart, LineChartProps, LineSeries, LineThreshold } from "
|
|
|
42
42
|
import { StatusBand, StatusBandProps, StatusLegend, StatusSegment } from "./components/StatusBand/StatusBand.js";
|
|
43
43
|
import { Meter, MeterProps } from "./components/Meter/Meter.js";
|
|
44
44
|
import { Zone, ZoneMap, ZoneMapProps } from "./components/ZoneMap/ZoneMap.js";
|
|
45
|
+
import { FloorPlan, FloorPlanEdge, FloorPlanGroup, FloorPlanProps, FloorPlanZone, MultiPolygon } from "./components/FloorPlan/FloorPlan.js";
|
|
45
46
|
import { EventKind, EventTimeline, EventTimelineProps, TimelineEvent, TimelineKind } from "./components/EventTimeline/EventTimeline.js";
|
|
46
47
|
import { ConsoleExtra, ConsoleLayout, ConsoleLayoutProps } from "./components/ConsoleLayout/ConsoleLayout.js";
|
|
47
48
|
import { consoleZoom } from "./deprecated.js";
|
|
@@ -93,4 +94,4 @@ import { MOTION } from "./motion.js";
|
|
|
93
94
|
import { ThemeSetting, divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript } from "./theme.js";
|
|
94
95
|
import { announce } from "./announce.js";
|
|
95
96
|
import { Workbench, WorkbenchApi, WorkbenchHandle, WorkbenchLayout, WorkbenchProps, WorkbenchRegion, WorkbenchView, useWorkbench } from "./components/Workbench/Workbench.js";
|
|
96
|
-
export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, type FilePicker, type FilePickerOptions, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
|
97
|
+
export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, type FilePicker, type FilePickerOptions, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, FloorPlan, type FloorPlanEdge, type FloorPlanGroup, type FloorPlanProps, type FloorPlanZone, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, type MultiPolygon, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ import { LineChart } from "./components/LineChart/LineChart.js";
|
|
|
41
41
|
import { StatusBand, StatusLegend } from "./components/StatusBand/StatusBand.js";
|
|
42
42
|
import { Meter } from "./components/Meter/Meter.js";
|
|
43
43
|
import { ZoneMap } from "./components/ZoneMap/ZoneMap.js";
|
|
44
|
+
import { FloorPlan } from "./components/FloorPlan/FloorPlan.js";
|
|
44
45
|
import { EventTimeline } from "./components/EventTimeline/EventTimeline.js";
|
|
45
46
|
import { ConsoleLayout } from "./components/ConsoleLayout/ConsoleLayout.js";
|
|
46
47
|
import { consoleZoom } from "./deprecated.js";
|
|
@@ -87,4 +88,4 @@ import { MOTION } from "./motion.js";
|
|
|
87
88
|
import { divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript } from "./theme.js";
|
|
88
89
|
import { announce } from "./announce.js";
|
|
89
90
|
import { Workbench, useWorkbench } from "./components/Workbench/Workbench.js";
|
|
90
|
-
export { AccentPicker, ActionBar, AiMark, Alert, AppShell, Badge, BarChart, Breadcrumb, Button, Calendar, Card, Checkbox, CodeText, CodeView, CommandPalette, ConsoleLayout, DangerZone, DataTable, DatePicker, DateRangePicker, DetailList, Dialog, Drawer, EmptyState, ErrorPage, EventTimeline, FileUpload, FormGrid, GraphDefs, GraphLegend, Grid, Icon, IconButton, InlineCode, KpiCard, LayerGraph, LineChart, Link, LoadingBar, LocaleProvider, LoginCard, MOTION, Markdown, Menu, Meter, MobileTabBar, MultiSelect, NotificationBell, Page, PageHeader, Popover, ProgressBar, ProgressRing, ProjectSwitcher, RadioGroup, RelativeTime, SearchField, Section, SectionGroup, SectionGroupToggle, SegmentedControl, Select, SettingsLayout, SettingsRow, SettingsSection, SideNav, Skeleton, SplitPane, StatusBand, StatusLegend, Suggestion, Switch, TOAST_DURATION, Tabs, Tag, Term, TextArea, TextField, ThemePicker, TimeControl, Toast, Toaster, Tooltip, TopBar, Tour, TreeList, Workbench, ZoneMap, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
|
91
|
+
export { AccentPicker, ActionBar, AiMark, Alert, AppShell, Badge, BarChart, Breadcrumb, Button, Calendar, Card, Checkbox, CodeText, CodeView, CommandPalette, ConsoleLayout, DangerZone, DataTable, DatePicker, DateRangePicker, DetailList, Dialog, Drawer, EmptyState, ErrorPage, EventTimeline, FileUpload, FloorPlan, FormGrid, GraphDefs, GraphLegend, Grid, Icon, IconButton, InlineCode, KpiCard, LayerGraph, LineChart, Link, LoadingBar, LocaleProvider, LoginCard, MOTION, Markdown, Menu, Meter, MobileTabBar, MultiSelect, NotificationBell, Page, PageHeader, Popover, ProgressBar, ProgressRing, ProjectSwitcher, RadioGroup, RelativeTime, SearchField, Section, SectionGroup, SectionGroupToggle, SegmentedControl, Select, SettingsLayout, SettingsRow, SettingsSection, SideNav, Skeleton, SplitPane, StatusBand, StatusLegend, Suggestion, Switch, TOAST_DURATION, Tabs, Tag, Term, TextArea, TextField, ThemePicker, TimeControl, Toast, Toaster, Tooltip, TopBar, Tour, TreeList, Workbench, ZoneMap, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFilePicker, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
package/dist/internal/util.js
CHANGED
|
@@ -55,6 +55,24 @@ const serverFalse = () => false;
|
|
|
55
55
|
function resizeObserver(cb) {
|
|
56
56
|
return typeof ResizeObserver === "function" ? new ResizeObserver(cb) : null;
|
|
57
57
|
}
|
|
58
|
+
let fontLoads = 0;
|
|
59
|
+
const fontListeners = /* @__PURE__ */ new Set();
|
|
60
|
+
if (typeof document !== "undefined" && typeof document.fonts?.addEventListener === "function") document.fonts.addEventListener("loadingdone", () => {
|
|
61
|
+
fontLoads++;
|
|
62
|
+
for (const f of fontListeners) f();
|
|
63
|
+
});
|
|
64
|
+
const subFonts = (f) => {
|
|
65
|
+
fontListeners.add(f);
|
|
66
|
+
return () => fontListeners.delete(f);
|
|
67
|
+
};
|
|
68
|
+
const getFonts = () => fontLoads;
|
|
69
|
+
const serverZero = () => 0;
|
|
70
|
+
/** A number that goes up each time web fonts finish loading (document.fonts `loadingdone`). Layout worked out from text
|
|
71
|
+
* measured on a canvas depends on it, so it is worked out again with the loaded fonts instead of keeping the fallback
|
|
72
|
+
* font's widths. 0 on the server and while hydrating. */
|
|
73
|
+
function useFontLoads() {
|
|
74
|
+
return React.useSyncExternalStore(subFonts, getFonts, serverZero);
|
|
75
|
+
}
|
|
58
76
|
/** True under 600 px, the same width where cards stack. */
|
|
59
77
|
function useNarrow() {
|
|
60
78
|
return useMedia("(max-width: 599px)");
|
|
@@ -103,6 +121,6 @@ function nodeText(node) {
|
|
|
103
121
|
function keepUnits(text) {
|
|
104
122
|
return text.replace(/(\d) (?=°|%|‰|[A-Za-zµΩ]{1,4}(?![A-Za-z])|[\u3400-\u9fff])/g, "$1\xA0").replace(/((?:^|[^\w$])(?:[A-Z]{2}\$|[$€£¥₩])) (?=[-−]?\d)/g, "$1\xA0");
|
|
105
123
|
}
|
|
106
|
-
export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, keepUnits, monoNums, nodeText, reduced, resizeObserver, seenOnly, useMedia, useNarrow };
|
|
124
|
+
export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, keepUnits, monoNums, nodeText, reduced, resizeObserver, seenOnly, useFontLoads, useMedia, useNarrow };
|
|
107
125
|
|
|
108
126
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,\n * so the markup matches; then the real match. */\nexport function useMedia(query: string): boolean {\n const sub = React.useCallback(\n (f: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const m = window.matchMedia(query);\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n },\n [query],\n );\n const get = React.useCallback(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches, [query]);\n return React.useSyncExternalStore(sub, get, serverFalse);\n}\nconst serverFalse = () => false;\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n\n/** A number and its unit never break apart: the space between them becomes a no-break space (U+00A0), so\n * 「100 MB」「29 °C」「3 筆」 do not wrap as 「100 / MB」 on a phone, nor a currency before the number (「NT$ 1,280」).\n * Leaves every other space alone. */\nexport function keepUnits(text: string): string {\n return text\n .replace(/(\\d) (?=°|%|‰|[A-Za-zµΩ]{1,4}(?![A-Za-z])|[\\u3400-\\u9fff])/g, '$1\\u00a0')\n .replace(/((?:^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QAAQ,OAAO,SAAS,WAAW,OAAO;CACtD,IAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU,OAAO,OAAO,IAAI;CAC5E,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO,KAAK,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE;CAC1D,IAAI,MAAM,eAAe,IAAI,GAAG;EAC9B,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,MAAM,kBAAkB,UAAU,OAAO,MAAM;EAC1D,OAAO,SAAS,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;CACtF;CACA,OAAO;AACT;;;;AAKA,SAAgB,UAAU,MAAsB;CAC9C,OAAO,KACJ,QAAQ,+DAA+D,QAAU,CAAC,CAClF,QAAQ,qDAAqD,QAAU;AAC5E"}
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,\n * so the markup matches; then the real match. */\nexport function useMedia(query: string): boolean {\n const sub = React.useCallback(\n (f: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const m = window.matchMedia(query);\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n },\n [query],\n );\n const get = React.useCallback(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches, [query]);\n return React.useSyncExternalStore(sub, get, serverFalse);\n}\nconst serverFalse = () => false;\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n// Web fonts that finished loading since this module ran: text measured on a canvas before then used the fallback font.\nlet fontLoads = 0;\nconst fontListeners = new Set<() => void>();\nif (typeof document !== 'undefined' && typeof document.fonts?.addEventListener === 'function') {\n document.fonts.addEventListener('loadingdone', () => {\n fontLoads++;\n for (const f of fontListeners) f();\n });\n}\nconst subFonts = (f: () => void) => {\n fontListeners.add(f);\n return () => fontListeners.delete(f);\n};\nconst getFonts = () => fontLoads;\nconst serverZero = () => 0;\n\n/** A number that goes up each time web fonts finish loading (document.fonts `loadingdone`). Layout worked out from text\n * measured on a canvas depends on it, so it is worked out again with the loaded fonts instead of keeping the fallback\n * font's widths. 0 on the server and while hydrating. */\nexport function useFontLoads(): number {\n return React.useSyncExternalStore(subFonts, getFonts, serverZero);\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n\n/** A number and its unit never break apart: the space between them becomes a no-break space (U+00A0), so\n * 「100 MB」「29 °C」「3 筆」 do not wrap as 「100 / MB」 on a phone, nor a currency before the number (「NT$ 1,280」).\n * Leaves every other space alone. */\nexport function keepUnits(text: string): string {\n return text\n .replace(/(\\d) (?=°|%|‰|[A-Za-zµΩ]{1,4}(?![A-Za-z])|[\\u3400-\\u9fff])/g, '$1\\u00a0')\n .replace(/((?:^|[^\\w$])(?:[A-Z]{2}\\$|[$€£¥₩])) (?=[-−]?\\d)/g, '$1\\u00a0');\n}\n"],"mappings":";;;;;;AAIA,MAAa,UAAU,MAAsB,mBAAmB,CAAC;;AAGjE,SAAgB,GAAG,GAAG,OAA0B;CAC9C,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAIA,SAAgB,SAAS,MAAc,MAAmC;CACxE,OAAO,WAAW,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,MAAM,oBAAC,QAAD;EAAc,WAAW,GAAG,WAAW,KAAK,KAAK,QAAQ;EAAG,aAAW,KAAK,IAAI,KAAK,KAAK;CAAI,GAAnF,CAAmF,CAAC;AAC5I;AAGA,SAAS,WAAW,MAAkC;CACpD,OACE,KAEG,MAAM,wBAAwB,CAAC,CAC/B,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,CAAC,GAAG;EAAC;EAAU;EAAU;CAA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AAI,MAAM,eAAe,IAAI,GAAG;EAC9B,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,MAAM,kBAAkB,UAAU,OAAO,MAAM;EAC1D,OAAO,SAAS,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;CACtF;CACA,OAAO;AACT;;;;AAKA,SAAgB,UAAU,MAAsB;CAC9C,OAAO,KACJ,QAAQ,+DAA+D,QAAU,CAAC,CAClF,QAAQ,qDAAqD,QAAU;AAC5E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { format } from "../format.js";
|
|
3
|
+
import { tr } from "../i18n.js";
|
|
4
|
+
import { heatToken, textOn } from "../theme.js";
|
|
5
|
+
// src/internal/zone.ts
|
|
6
|
+
/** Data tokens whose text color comes from CSS (it follows the theme); other fills are measured with textOn(). */
|
|
7
|
+
const DATA_TOKEN = /^(heat-[1-7]|diverge-(neg|pos)(-strong)?|diverge-zero|chart-[1-4])$/;
|
|
8
|
+
/** The heat range: min and max when given, else the zones' own smallest and largest value. One value alone (or all
|
|
9
|
+
* equal) gets that value ± 1, so it lands in the middle of the scale. */
|
|
10
|
+
function heatRange(zones, min, max) {
|
|
11
|
+
const values = zones.map((z) => z.value).filter((v) => v != null && Number.isFinite(v));
|
|
12
|
+
const lo = min ?? (values.length ? Math.min(...values) : 0);
|
|
13
|
+
const hi = max ?? (values.length ? Math.max(...values) : 1);
|
|
14
|
+
return hi > lo ? [lo, hi] : [lo - 1, lo + 1];
|
|
15
|
+
}
|
|
16
|
+
/** True when the zone has no data: a dashed outline, not selectable. */
|
|
17
|
+
const noData = (z) => z.value == null && !z.forecast;
|
|
18
|
+
/** The fill (token name or color), its CSS background, the text color for a fill that is not a data token, the state
|
|
19
|
+
* with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name. */
|
|
20
|
+
function zoneText(z, min, max, extra = []) {
|
|
21
|
+
const tone = z.tone ?? "normal";
|
|
22
|
+
const fill = z.fill ?? (z.value != null ? heatToken(z.value, min, max) : "surface-sub");
|
|
23
|
+
const bg = /^[a-z][a-z0-9-]*$/.test(fill) ? `var(--${fill})` : fill;
|
|
24
|
+
const stateWord = z.state ?? (z.forecast ? tr("預測") : tr("正常"));
|
|
25
|
+
const state = (tone === "normal" ? "" : "⚠ ") + stateWord;
|
|
26
|
+
const figure = z.value != null ? format.number(z.value, z.decimals ?? 1) : "—";
|
|
27
|
+
const reading = figure + (z.unit ? " " + z.unit : "");
|
|
28
|
+
const label = [
|
|
29
|
+
z.name,
|
|
30
|
+
reading,
|
|
31
|
+
stateWord,
|
|
32
|
+
...extra,
|
|
33
|
+
z.detail
|
|
34
|
+
].filter(Boolean).join(tr(","));
|
|
35
|
+
return {
|
|
36
|
+
tone,
|
|
37
|
+
fill,
|
|
38
|
+
bg,
|
|
39
|
+
color: DATA_TOKEN.test(fill) ? void 0 : textOn(fill),
|
|
40
|
+
state,
|
|
41
|
+
figure,
|
|
42
|
+
reading,
|
|
43
|
+
label
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export { DATA_TOKEN, heatRange, noData, zoneText };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=zone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone.js","names":[],"sources":["../../src/internal/zone.ts"],"sourcesContent":["// What ZoneMap and FloorPlan share: the heat range, and a zone's fill, figure, state and accessible name.\nimport { format } from '../format';\nimport { tr } from '../i18n';\nimport { heatToken, textOn } from '../theme';\n\n/** The fields of a zone both maps read. */\ninterface ZoneText {\n name: string;\n value?: number | null;\n unit?: string;\n decimals?: number;\n fill?: string;\n tone?: 'normal' | 'warning' | 'danger';\n state?: string;\n forecast?: boolean;\n detail?: string;\n}\n\n/** Data tokens whose text color comes from CSS (it follows the theme); other fills are measured with textOn(). */\nexport const DATA_TOKEN = /^(heat-[1-7]|diverge-(neg|pos)(-strong)?|diverge-zero|chart-[1-4])$/;\n\n/** The heat range: min and max when given, else the zones' own smallest and largest value. One value alone (or all\n * equal) gets that value ± 1, so it lands in the middle of the scale. */\nexport function heatRange(zones: readonly { value?: number | null }[], min?: number, max?: number): [number, number] {\n const values = zones.map((z) => z.value).filter((v): v is number => v != null && Number.isFinite(v));\n const lo = min ?? (values.length ? Math.min(...values) : 0);\n const hi = max ?? (values.length ? Math.max(...values) : 1);\n return hi > lo ? [lo, hi] : [lo - 1, lo + 1];\n}\n\n/** True when the zone has no data: a dashed outline, not selectable. */\nexport const noData = (z: ZoneText): boolean => z.value == null && !z.forecast;\n\n/** The fill (token name or color), its CSS background, the text color for a fill that is not a data token, the state\n * with 「⚠ 」 when it needs attention, the figure, the figure with its unit, and the accessible name. */\nexport function zoneText(z: ZoneText, min: number, max: number, extra: string[] = []) {\n const tone = z.tone ?? 'normal';\n const fill = z.fill ?? (z.value != null ? heatToken(z.value, min, max) : 'surface-sub');\n const bg = /^[a-z][a-z0-9-]*$/.test(fill) ? `var(--${fill})` : fill;\n const stateWord = z.state ?? (z.forecast ? tr('預測') : tr('正常'));\n const state = (tone === 'normal' ? '' : '⚠ ') + stateWord;\n const figure = z.value != null ? format.number(z.value, z.decimals ?? 1) : '—';\n const reading = figure + (z.unit ? ' ' + z.unit : '');\n const label = [z.name, reading, stateWord, ...extra, z.detail].filter(Boolean).join(tr(','));\n const color = DATA_TOKEN.test(fill) ? undefined : textOn(fill);\n return { tone, fill, bg, color, state, figure, reading, label };\n}\n"],"mappings":";;;;;;AAmBA,MAAa,aAAa;;;AAI1B,SAAgB,UAAU,OAA6C,KAAc,KAAgC;CACnH,MAAM,SAAS,MAAM,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,MAAmB,KAAK,QAAQ,OAAO,SAAS,CAAC,CAAC;CACnG,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD,MAAM,KAAK,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CACzD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