diff --git a/fe-app-tachyon/src/icons/index.ts b/fe-app-tachyon/src/icons/index.ts index af25c4e7..2bf89f13 100644 --- a/fe-app-tachyon/src/icons/index.ts +++ b/fe-app-tachyon/src/icons/index.ts @@ -1,24 +1,284 @@ -export * from './renderLoaderCircleIcon24'; -export * from './renderCircleAlertIcon24'; -export * from './renderCircleCheckIcon24'; -export * from './renderCircleSlashIcon24'; -export * from './renderCircleXIcon24'; -export * from './renderCheckIcon24'; -export * from './renderXIcon24'; -export * from './renderTriangleAlertIcon24'; -export * from './renderPauseIcon24'; -export * from './renderPlayIcon24'; -export * from './renderRotateCcwIcon24'; -export * from './renderCircleStopIcon24'; -export * from './renderCirclePlayIcon24'; -export * from './renderCircleCheckBigIcon24'; -export * from './renderSquareChartGanttIcon24'; -export * from './renderCogIcon24'; -export * from './renderSearchIcon24'; -export * from './renderBookOpenTextIcon24'; -export * from './renderCopyIcon24'; -export * from './renderLinkIcon24'; -export * from './renderDownloadIcon24'; -export * from './renderInfoIcon24'; -export * from './renderGlobeIcon24'; -export * from './renderSendIcon24'; +import { svgEl } from '../helpers'; + +function createIcon( + className: string, + children: (SVGElement | null | undefined)[], + extraAttrs: Partial> = {}, +) { + return svgEl( + 'svg', + { + xmlns: 'http://www.w3.org/2000/svg', + viewBox: '0 0 24 24', + fill: 'none', + stroke: 'currentColor', + 'stroke-width': '2', + 'stroke-linecap': 'round', + 'stroke-linejoin': 'round', + class: className, + ...extraAttrs, + }, + children, + ); +} + +export function renderBookOpenTextIcon24() { + return createIcon('lucide lucide-book-open-text-icon lucide-book-open-text', [ + svgEl('path', { d: 'M12 7v14' }), + svgEl('path', { d: 'M16 12h2' }), + svgEl('path', { d: 'M16 8h2' }), + svgEl('path', { + d: 'M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z', + }), + svgEl('path', { d: 'M6 12h2' }), + svgEl('path', { d: 'M6 8h2' }), + ]); +} + +export function renderCheckIcon24() { + return createIcon('lucide lucide-check-icon lucide-check', [ + svgEl('path', { d: 'M20 6 9 17l-5-5' }), + ]); +} + +export function renderCircleAlertIcon24() { + return createIcon( + 'lucide lucide-circle-alert-icon lucide-circle-alert', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('line', { x1: '12', y1: '8', x2: '12', y2: '12' }), + svgEl('line', { x1: '12', y1: '16', x2: '12.01', y2: '16' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderCircleCheckBigIcon24() { + return createIcon('lucide lucide-circle-check-big-icon lucide-circle-check-big', [ + svgEl('path', { d: 'M21.801 10A10 10 0 1 1 17 3.335' }), + svgEl('path', { d: 'm9 11 3 3L22 4' }), + ]); +} + +export function renderCircleCheckIcon24() { + return createIcon( + 'lucide lucide-circle-check-icon lucide-circle-check', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('path', { d: 'M9 12l2 2 4-4' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderCirclePlayIcon24() { + return createIcon('lucide lucide-circle-play-icon lucide-circle-play', [ + svgEl('path', { + d: 'M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z', + }), + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + ]); +} + +export function renderCircleSlashIcon24() { + return createIcon( + 'lucide lucide-circle-slash-icon lucide-circle-slash', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('line', { x1: '9', y1: '15', x2: '15', y2: '9' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderCircleStopIcon24() { + return createIcon('lucide lucide-circle-stop-icon lucide-circle-stop', [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('rect', { x: '9', y: '9', width: '6', height: '6', rx: '1' }), + ]); +} + +export function renderCircleXIcon24() { + return createIcon( + 'lucide lucide-circle-x-icon lucide-circle-x', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('path', { d: 'M15 9L9 15' }), + svgEl('path', { d: 'M9 9L15 15' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderCogIcon24() { + return createIcon('lucide lucide-cog-icon lucide-cog', [ + svgEl('path', { d: 'M11 10.27 7 3.34' }), + svgEl('path', { d: 'm11 13.73-4 6.93' }), + svgEl('path', { d: 'M12 22v-2' }), + svgEl('path', { d: 'M12 2v2' }), + svgEl('path', { d: 'M14 12h8' }), + svgEl('path', { d: 'm17 20.66-1-1.73' }), + svgEl('path', { d: 'm17 3.34-1 1.73' }), + svgEl('path', { d: 'M2 12h2' }), + svgEl('path', { d: 'm20.66 17-1.73-1' }), + svgEl('path', { d: 'm20.66 7-1.73 1' }), + svgEl('path', { d: 'm3.34 17 1.73-1' }), + svgEl('path', { d: 'm3.34 7 1.73 1' }), + svgEl('circle', { cx: '12', cy: '12', r: '2' }), + svgEl('circle', { cx: '12', cy: '12', r: '8' }), + ]); +} + +export function renderCopyIcon24() { + return createIcon( + 'lucide lucide-copy-icon lucide-copy', + [ + svgEl('rect', { + width: '14', + height: '14', + x: '8', + y: '8', + rx: '2', + ry: '2', + }), + svgEl('path', { + d: 'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2', + }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderDownloadIcon24() { + return createIcon('lucide lucide-download-icon lucide-download', [ + svgEl('path', { d: 'M12 15V3' }), + svgEl('path', { d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4' }), + svgEl('path', { d: 'm7 10 5 5 5-5' }), + ]); +} + +export function renderGlobeIcon24() { + return createIcon( + 'lucide lucide-globe-icon lucide-globe', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('path', { d: 'M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20' }), + svgEl('path', { d: 'M2 12h20' }), + ], + { width: '14', height: '14' }, + ); +} + +export function renderInfoIcon24() { + return createIcon( + 'lucide lucide-info-icon lucide-info', + [ + svgEl('circle', { cx: '12', cy: '12', r: '10' }), + svgEl('path', { d: 'M12 16v-4' }), + svgEl('path', { d: 'M12 8h.01' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderLinkIcon24() { + return createIcon( + 'lucide lucide-link-icon lucide-link', + [ + svgEl('path', { + d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71', + }), + svgEl('path', { + d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71', + }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderLoaderCircleIcon24() { + return createIcon( + 'lucide lucide-loader-circle rotate', + [ + svgEl('path', { d: 'M21 12a9 9 0 1 1-6.219-8.56' }), + svgEl('animateTransform', { + attributeName: 'transform', + attributeType: 'XML', + type: 'rotate', + from: '0 12 12', + to: '360 12 12', + dur: '1s', + repeatCount: 'indefinite', + }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderPauseIcon24() { + return createIcon('lucide lucide-pause-icon lucide-pause', [ + svgEl('rect', { x: '14', y: '3', width: '5', height: '18', rx: '1' }), + svgEl('rect', { x: '5', y: '3', width: '5', height: '18', rx: '1' }), + ]); +} + +export function renderPlayIcon24() { + return createIcon('lucide lucide-play-icon lucide-play', [ + svgEl('path', { + d: 'M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z', + }), + ]); +} + +export function renderRotateCcwIcon24() { + return createIcon('lucide lucide-rotate-ccw-icon lucide-rotate-ccw', [ + svgEl('path', { d: 'M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8' }), + svgEl('path', { d: 'M3 3v5h5' }), + ]); +} + +export function renderSearchIcon24() { + return createIcon('lucide lucide-search-icon lucide-search', [ + svgEl('path', { d: 'm21 21-4.34-4.34' }), + svgEl('circle', { cx: '11', cy: '11', r: '8' }), + ]); +} + +export function renderSendIcon24() { + return createIcon( + 'lucide lucide-send-icon lucide-send', + [ + svgEl('path', { + d: 'M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z', + }), + svgEl('path', { d: 'm21.854 2.147-10.94 10.939' }), + ], + { width: '24', height: '24' }, + ); +} + +export function renderSquareChartGanttIcon24() { + return createIcon('lucide lucide-square-chart-gantt-icon lucide-square-chart-gantt', [ + svgEl('rect', { width: '18', height: '18', x: '3', y: '3', rx: '2' }), + svgEl('path', { d: 'M9 8h7' }), + svgEl('path', { d: 'M8 12h6' }), + svgEl('path', { d: 'M11 16h5' }), + ]); +} + +export function renderTriangleAlertIcon24() { + return createIcon('lucide lucide-triangle-alert-icon lucide-triangle-alert', [ + svgEl('path', { + d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3', + }), + svgEl('path', { d: 'M12 9v4' }), + svgEl('path', { d: 'M12 17h.01' }), + ]); +} + +export function renderXIcon24() { + return createIcon('lucide lucide-x-icon lucide-x', [ + svgEl('path', { d: 'M18 6 6 18' }), + svgEl('path', { d: 'm6 6 12 12' }), + ]); +} diff --git a/fe-app-tachyon/src/icons/renderBookOpenTextIcon24.ts b/fe-app-tachyon/src/icons/renderBookOpenTextIcon24.ts deleted file mode 100644 index 552f8ffe..00000000 --- a/fe-app-tachyon/src/icons/renderBookOpenTextIcon24.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderBookOpenTextIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-book-open-text-icon lucide-book-open-text', - }, - [ - svgEl('path', { d: 'M12 7v14' }), - svgEl('path', { d: 'M16 12h2' }), - svgEl('path', { d: 'M16 8h2' }), - svgEl('path', { - d: 'M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z', - }), - svgEl('path', { d: 'M6 12h2' }), - svgEl('path', { d: 'M6 8h2' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCheckIcon24.ts b/fe-app-tachyon/src/icons/renderCheckIcon24.ts deleted file mode 100644 index b1c9ab2d..00000000 --- a/fe-app-tachyon/src/icons/renderCheckIcon24.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCheckIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-check-icon lucide-check', - }, - [ - svgEl('path', { - d: 'M20 6 9 17l-5-5', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleAlertIcon24.ts b/fe-app-tachyon/src/icons/renderCircleAlertIcon24.ts deleted file mode 100644 index 8e6820b2..00000000 --- a/fe-app-tachyon/src/icons/renderCircleAlertIcon24.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleAlertIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-alert-icon lucide-circle-alert', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('line', { - x1: '12', - y1: '8', - x2: '12', - y2: '12', - }), - svgEl('line', { - x1: '12', - y1: '16', - x2: '12.01', - y2: '16', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleCheckBigIcon24.ts b/fe-app-tachyon/src/icons/renderCircleCheckBigIcon24.ts deleted file mode 100644 index e353091c..00000000 --- a/fe-app-tachyon/src/icons/renderCircleCheckBigIcon24.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleCheckBigIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-check-big-icon lucide-circle-check-big', - }, - [ - svgEl('path', { - d: 'M21.801 10A10 10 0 1 1 17 3.335', - }), - svgEl('path', { - d: 'm9 11 3 3L22 4', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleCheckIcon24.ts b/fe-app-tachyon/src/icons/renderCircleCheckIcon24.ts deleted file mode 100644 index 4ccf018c..00000000 --- a/fe-app-tachyon/src/icons/renderCircleCheckIcon24.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleCheckIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-check-icon lucide-circle-check', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('path', { - d: 'M9 12l2 2 4-4', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCirclePlayIcon24.ts b/fe-app-tachyon/src/icons/renderCirclePlayIcon24.ts deleted file mode 100644 index a4102f10..00000000 --- a/fe-app-tachyon/src/icons/renderCirclePlayIcon24.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCirclePlayIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-play-icon lucide-circle-play', - }, - [ - svgEl('path', { - d: 'M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z', - }), - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleSlashIcon24.ts b/fe-app-tachyon/src/icons/renderCircleSlashIcon24.ts deleted file mode 100644 index e082c114..00000000 --- a/fe-app-tachyon/src/icons/renderCircleSlashIcon24.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleSlashIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-slash-icon lucide-circle-slash', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('line', { - x1: '9', - y1: '15', - x2: '15', - y2: '9', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleStopIcon24.ts b/fe-app-tachyon/src/icons/renderCircleStopIcon24.ts deleted file mode 100644 index bb9e6142..00000000 --- a/fe-app-tachyon/src/icons/renderCircleStopIcon24.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleStopIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-stop-icon lucide-circle-stop', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('rect', { - x: '9', - y: '9', - width: '6', - height: '6', - rx: '1', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCircleXIcon24.ts b/fe-app-tachyon/src/icons/renderCircleXIcon24.ts deleted file mode 100644 index 56956178..00000000 --- a/fe-app-tachyon/src/icons/renderCircleXIcon24.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCircleXIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-circle-x-icon lucide-circle-x', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('path', { - d: 'M15 9L9 15', - }), - svgEl('path', { - d: 'M9 9L15 15', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCogIcon24.ts b/fe-app-tachyon/src/icons/renderCogIcon24.ts deleted file mode 100644 index 0093bbbd..00000000 --- a/fe-app-tachyon/src/icons/renderCogIcon24.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderCogIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-cog-icon lucide-cog', - }, - [ - svgEl('path', { d: 'M11 10.27 7 3.34' }), - svgEl('path', { d: 'm11 13.73-4 6.93' }), - svgEl('path', { d: 'M12 22v-2' }), - svgEl('path', { d: 'M12 2v2' }), - svgEl('path', { d: 'M14 12h8' }), - svgEl('path', { d: 'm17 20.66-1-1.73' }), - svgEl('path', { d: 'm17 3.34-1 1.73' }), - svgEl('path', { d: 'M2 12h2' }), - svgEl('path', { d: 'm20.66 17-1.73-1' }), - svgEl('path', { d: 'm20.66 7-1.73 1' }), - svgEl('path', { d: 'm3.34 17 1.73-1' }), - svgEl('path', { d: 'm3.34 7 1.73 1' }), - svgEl('circle', { cx: '12', cy: '12', r: '2' }), - svgEl('circle', { cx: '12', cy: '12', r: '8' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderCopyIcon24.ts b/fe-app-tachyon/src/icons/renderCopyIcon24.ts deleted file mode 100644 index c0a24997..00000000 --- a/fe-app-tachyon/src/icons/renderCopyIcon24.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { svgEl } from '../helpers/svgEl'; - -export function renderCopyIcon24() { - return svgEl( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-copy-icon lucide-copy', - }, - [ - svgEl('rect', { - width: '14', - height: '14', - x: '8', - y: '8', - rx: '2', - ry: '2', - }), - svgEl('path', { - d: 'M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderDownloadIcon24.ts b/fe-app-tachyon/src/icons/renderDownloadIcon24.ts deleted file mode 100644 index 12ec462a..00000000 --- a/fe-app-tachyon/src/icons/renderDownloadIcon24.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderDownloadIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-download-icon lucide-download', - }, - [ - svgEl('path', { - d: 'M12 15V3', - }), - svgEl('path', { - d: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4', - }), - svgEl('path', { - d: 'm7 10 5 5 5-5', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderGlobeIcon24.ts b/fe-app-tachyon/src/icons/renderGlobeIcon24.ts deleted file mode 100644 index 9bd1bb4e..00000000 --- a/fe-app-tachyon/src/icons/renderGlobeIcon24.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { svgEl } from '../helpers/svgEl'; - -export function renderGlobeIcon24() { - return svgEl( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - width: '14', - height: '14', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-globe-icon lucide-globe', - }, - [ - svgEl('circle', { cx: '12', cy: '12', r: '10' }), - svgEl('path', { d: 'M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20' }), - svgEl('path', { d: 'M2 12h20' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderInfoIcon24.ts b/fe-app-tachyon/src/icons/renderInfoIcon24.ts deleted file mode 100644 index 1cea9048..00000000 --- a/fe-app-tachyon/src/icons/renderInfoIcon24.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { svgEl } from '../helpers/svgEl'; - -export function renderInfoIcon24() { - return svgEl( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-info-icon lucide-info', - }, - [ - svgEl('circle', { - cx: '12', - cy: '12', - r: '10', - }), - svgEl('path', { - d: 'M12 16v-4', - }), - svgEl('path', { - d: 'M12 8h.01', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderLinkIcon24.ts b/fe-app-tachyon/src/icons/renderLinkIcon24.ts deleted file mode 100644 index 29a2f814..00000000 --- a/fe-app-tachyon/src/icons/renderLinkIcon24.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { svgEl } from '../helpers/svgEl'; - -export function renderLinkIcon24() { - return svgEl( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-link-icon lucide-link', - }, - [ - svgEl('path', { - d: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71', - }), - svgEl('path', { - d: 'M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderLoaderCircleIcon24.ts b/fe-app-tachyon/src/icons/renderLoaderCircleIcon24.ts deleted file mode 100644 index a338a547..00000000 --- a/fe-app-tachyon/src/icons/renderLoaderCircleIcon24.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderLoaderCircleIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - width: '24', - height: '24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-loader-circle rotate', - }, - [ - svgEl('path', { - d: 'M21 12a9 9 0 1 1-6.219-8.56', - }), - svgEl('animateTransform', { - attributeName: 'transform', - attributeType: 'XML', - type: 'rotate', - from: '0 12 12', - to: '360 12 12', - dur: '1s', - repeatCount: 'indefinite', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderPauseIcon24.ts b/fe-app-tachyon/src/icons/renderPauseIcon24.ts deleted file mode 100644 index 8b150c79..00000000 --- a/fe-app-tachyon/src/icons/renderPauseIcon24.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderPauseIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-pause-icon lucide-pause', - }, - [ - svgEl('rect', { - x: '14', - y: '3', - width: '5', - height: '18', - rx: '1', - }), - svgEl('rect', { - x: '5', - y: '3', - width: '5', - height: '18', - rx: '1', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderPlayIcon24.ts b/fe-app-tachyon/src/icons/renderPlayIcon24.ts deleted file mode 100644 index 46c161d7..00000000 --- a/fe-app-tachyon/src/icons/renderPlayIcon24.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderPlayIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-play-icon lucide-play', - }, - [ - svgEl('path', { - d: 'M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderRotateCcwIcon24.ts b/fe-app-tachyon/src/icons/renderRotateCcwIcon24.ts deleted file mode 100644 index 82a5d162..00000000 --- a/fe-app-tachyon/src/icons/renderRotateCcwIcon24.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderRotateCcwIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-rotate-ccw-icon lucide-rotate-ccw', - }, - [ - svgEl('path', { - d: 'M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8', - }), - svgEl('path', { - d: 'M3 3v5h5', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderSearchIcon24.ts b/fe-app-tachyon/src/icons/renderSearchIcon24.ts deleted file mode 100644 index 30253845..00000000 --- a/fe-app-tachyon/src/icons/renderSearchIcon24.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderSearchIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-search-icon lucide-search', - }, - [ - svgEl('path', { d: 'm21 21-4.34-4.34' }), - svgEl('circle', { cx: '11', cy: '11', r: '8' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderSendIcon24.ts b/fe-app-tachyon/src/icons/renderSendIcon24.ts deleted file mode 100644 index 6da92a02..00000000 --- a/fe-app-tachyon/src/icons/renderSendIcon24.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { svgEl } from '../helpers/svgEl'; - -export function renderSendIcon24() { - return svgEl( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - width: '24', - height: '24', - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-send-icon lucide-send', - }, - [ - svgEl('path', { - d: 'M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z', - }), - svgEl('path', { - d: 'm21.854 2.147-10.94 10.939', - }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderSquareChartGanttIcon24.ts b/fe-app-tachyon/src/icons/renderSquareChartGanttIcon24.ts deleted file mode 100644 index 16c500ed..00000000 --- a/fe-app-tachyon/src/icons/renderSquareChartGanttIcon24.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderSquareChartGanttIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-square-chart-gantt-icon lucide-square-chart-gantt', - }, - [ - svgEl('rect', { - width: '18', - height: '18', - x: '3', - y: '3', - rx: '2', - }), - svgEl('path', { d: 'M9 8h7' }), - svgEl('path', { d: 'M8 12h6' }), - svgEl('path', { d: 'M11 16h5' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderTriangleAlertIcon24.ts b/fe-app-tachyon/src/icons/renderTriangleAlertIcon24.ts deleted file mode 100644 index 993b3175..00000000 --- a/fe-app-tachyon/src/icons/renderTriangleAlertIcon24.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderTriangleAlertIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-triangle-alert-icon lucide-triangle-alert', - }, - [ - svgEl('path', { - d: 'm21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3', - }), - svgEl('path', { d: 'M12 9v4' }), - svgEl('path', { d: 'M12 17h.01' }), - ], - ); -} diff --git a/fe-app-tachyon/src/icons/renderXIcon24.ts b/fe-app-tachyon/src/icons/renderXIcon24.ts deleted file mode 100644 index d8b6ce69..00000000 --- a/fe-app-tachyon/src/icons/renderXIcon24.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { svgEl } from '../helpers'; - -export function renderXIcon24() { - const NS = 'http://www.w3.org/2000/svg'; - return svgEl( - 'svg', - { - xmlns: NS, - viewBox: '0 0 24 24', - fill: 'none', - stroke: 'currentColor', - 'stroke-width': '2', - 'stroke-linecap': 'round', - 'stroke-linejoin': 'round', - class: 'lucide lucide-x-icon lucide-x', - }, - [svgEl('path', { d: 'M18 6 6 18' }), svgEl('path', { d: 'm6 6 12 12' })], - ); -} diff --git a/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/main.js b/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/main.js index 8ce5f074..82d1c539 100644 --- a/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/main.js +++ b/luci-app-tachyon/htdocs/luci-static/resources/view/tachyon/main.js @@ -1481,541 +1481,124 @@ function isCopyableProxyLink(link) { return COPYABLE_PROXY_URI_RE.test((link || "").trim()); } -// src/icons/renderLoaderCircleIcon24.ts -function renderLoaderCircleIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - width: "24", - height: "24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-loader-circle rotate" - }, - [ - svgEl("path", { - d: "M21 12a9 9 0 1 1-6.219-8.56" - }), - svgEl("animateTransform", { - attributeName: "transform", - attributeType: "XML", - type: "rotate", - from: "0 12 12", - to: "360 12 12", - dur: "1s", - repeatCount: "indefinite" - }) - ] - ); -} - -// src/icons/renderCircleAlertIcon24.ts -function renderCircleAlertIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-alert-icon lucide-circle-alert" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("line", { - x1: "12", - y1: "8", - x2: "12", - y2: "12" - }), - svgEl("line", { - x1: "12", - y1: "16", - x2: "12.01", - y2: "16" - }) - ] - ); -} - -// src/icons/renderCircleCheckIcon24.ts -function renderCircleCheckIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-check-icon lucide-circle-check" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("path", { - d: "M9 12l2 2 4-4" - }) - ] - ); -} - -// src/icons/renderCircleSlashIcon24.ts -function renderCircleSlashIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-slash-icon lucide-circle-slash" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("line", { - x1: "9", - y1: "15", - x2: "15", - y2: "9" - }) - ] - ); -} - -// src/icons/renderCircleXIcon24.ts -function renderCircleXIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-x-icon lucide-circle-x" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("path", { - d: "M15 9L9 15" - }), - svgEl("path", { - d: "M9 9L15 15" - }) - ] - ); -} - -// src/icons/renderCheckIcon24.ts -function renderCheckIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-check-icon lucide-check" - }, - [ - svgEl("path", { - d: "M20 6 9 17l-5-5" - }) - ] - ); -} - -// src/icons/renderXIcon24.ts -function renderXIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-x-icon lucide-x" - }, - [svgEl("path", { d: "M18 6 6 18" }), svgEl("path", { d: "m6 6 12 12" })] - ); -} - -// src/icons/renderTriangleAlertIcon24.ts -function renderTriangleAlertIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-triangle-alert-icon lucide-triangle-alert" - }, - [ - svgEl("path", { - d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" - }), - svgEl("path", { d: "M12 9v4" }), - svgEl("path", { d: "M12 17h.01" }) - ] - ); -} - -// src/icons/renderPauseIcon24.ts -function renderPauseIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-pause-icon lucide-pause" - }, - [ - svgEl("rect", { - x: "14", - y: "3", - width: "5", - height: "18", - rx: "1" - }), - svgEl("rect", { - x: "5", - y: "3", - width: "5", - height: "18", - rx: "1" - }) - ] - ); -} - -// src/icons/renderPlayIcon24.ts -function renderPlayIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-play-icon lucide-play" - }, - [ - svgEl("path", { - d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" - }) - ] - ); -} - -// src/icons/renderRotateCcwIcon24.ts -function renderRotateCcwIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-rotate-ccw-icon lucide-rotate-ccw" - }, - [ - svgEl("path", { - d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" - }), - svgEl("path", { - d: "M3 3v5h5" - }) - ] - ); -} - -// src/icons/renderCircleStopIcon24.ts -function renderCircleStopIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-stop-icon lucide-circle-stop" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("rect", { - x: "9", - y: "9", - width: "6", - height: "6", - rx: "1" - }) - ] - ); -} - -// src/icons/renderCirclePlayIcon24.ts -function renderCirclePlayIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-play-icon lucide-circle-play" - }, - [ - svgEl("path", { - d: "M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z" - }), - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }) - ] - ); -} - -// src/icons/renderCircleCheckBigIcon24.ts -function renderCircleCheckBigIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-circle-check-big-icon lucide-circle-check-big" - }, - [ - svgEl("path", { - d: "M21.801 10A10 10 0 1 1 17 3.335" - }), - svgEl("path", { - d: "m9 11 3 3L22 4" - }) - ] - ); -} - -// src/icons/renderSquareChartGanttIcon24.ts -function renderSquareChartGanttIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-square-chart-gantt-icon lucide-square-chart-gantt" - }, - [ - svgEl("rect", { - width: "18", - height: "18", - x: "3", - y: "3", - rx: "2" - }), - svgEl("path", { d: "M9 8h7" }), - svgEl("path", { d: "M8 12h6" }), - svgEl("path", { d: "M11 16h5" }) - ] - ); -} - -// src/icons/renderCogIcon24.ts -function renderCogIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-cog-icon lucide-cog" - }, - [ - svgEl("path", { d: "M11 10.27 7 3.34" }), - svgEl("path", { d: "m11 13.73-4 6.93" }), - svgEl("path", { d: "M12 22v-2" }), - svgEl("path", { d: "M12 2v2" }), - svgEl("path", { d: "M14 12h8" }), - svgEl("path", { d: "m17 20.66-1-1.73" }), - svgEl("path", { d: "m17 3.34-1 1.73" }), - svgEl("path", { d: "M2 12h2" }), - svgEl("path", { d: "m20.66 17-1.73-1" }), - svgEl("path", { d: "m20.66 7-1.73 1" }), - svgEl("path", { d: "m3.34 17 1.73-1" }), - svgEl("path", { d: "m3.34 7 1.73 1" }), - svgEl("circle", { cx: "12", cy: "12", r: "2" }), - svgEl("circle", { cx: "12", cy: "12", r: "8" }) - ] - ); -} - -// src/icons/renderSearchIcon24.ts -function renderSearchIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-search-icon lucide-search" - }, - [ - svgEl("path", { d: "m21 21-4.34-4.34" }), - svgEl("circle", { cx: "11", cy: "11", r: "8" }) - ] - ); -} - -// src/icons/renderBookOpenTextIcon24.ts -function renderBookOpenTextIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-book-open-text-icon lucide-book-open-text" - }, - [ - svgEl("path", { d: "M12 7v14" }), - svgEl("path", { d: "M16 12h2" }), - svgEl("path", { d: "M16 8h2" }), - svgEl("path", { - d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" - }), - svgEl("path", { d: "M6 12h2" }), - svgEl("path", { d: "M6 8h2" }) - ] - ); -} - -// src/icons/renderCopyIcon24.ts -function renderCopyIcon24() { +// src/icons/index.ts +function createIcon(className, children, extraAttrs = {}) { return svgEl( "svg", { xmlns: "http://www.w3.org/2000/svg", - width: "24", - height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", - class: "lucide lucide-copy-icon lucide-copy" + class: className, + ...extraAttrs }, + children + ); +} +function renderBookOpenTextIcon24() { + return createIcon("lucide lucide-book-open-text-icon lucide-book-open-text", [ + svgEl("path", { d: "M12 7v14" }), + svgEl("path", { d: "M16 12h2" }), + svgEl("path", { d: "M16 8h2" }), + svgEl("path", { + d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" + }), + svgEl("path", { d: "M6 12h2" }), + svgEl("path", { d: "M6 8h2" }) + ]); +} +function renderCheckIcon24() { + return createIcon("lucide lucide-check-icon lucide-check", [ + svgEl("path", { d: "M20 6 9 17l-5-5" }) + ]); +} +function renderCircleAlertIcon24() { + return createIcon( + "lucide lucide-circle-alert-icon lucide-circle-alert", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("line", { x1: "12", y1: "8", x2: "12", y2: "12" }), + svgEl("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" }) + ], + { width: "24", height: "24" } + ); +} +function renderCircleCheckBigIcon24() { + return createIcon("lucide lucide-circle-check-big-icon lucide-circle-check-big", [ + svgEl("path", { d: "M21.801 10A10 10 0 1 1 17 3.335" }), + svgEl("path", { d: "m9 11 3 3L22 4" }) + ]); +} +function renderCircleCheckIcon24() { + return createIcon( + "lucide lucide-circle-check-icon lucide-circle-check", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("path", { d: "M9 12l2 2 4-4" }) + ], + { width: "24", height: "24" } + ); +} +function renderCirclePlayIcon24() { + return createIcon("lucide lucide-circle-play-icon lucide-circle-play", [ + svgEl("path", { + d: "M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z" + }), + svgEl("circle", { cx: "12", cy: "12", r: "10" }) + ]); +} +function renderCircleSlashIcon24() { + return createIcon( + "lucide lucide-circle-slash-icon lucide-circle-slash", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("line", { x1: "9", y1: "15", x2: "15", y2: "9" }) + ], + { width: "24", height: "24" } + ); +} +function renderCircleStopIcon24() { + return createIcon("lucide lucide-circle-stop-icon lucide-circle-stop", [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("rect", { x: "9", y: "9", width: "6", height: "6", rx: "1" }) + ]); +} +function renderCircleXIcon24() { + return createIcon( + "lucide lucide-circle-x-icon lucide-circle-x", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("path", { d: "M15 9L9 15" }), + svgEl("path", { d: "M9 9L15 15" }) + ], + { width: "24", height: "24" } + ); +} +function renderCogIcon24() { + return createIcon("lucide lucide-cog-icon lucide-cog", [ + svgEl("path", { d: "M11 10.27 7 3.34" }), + svgEl("path", { d: "m11 13.73-4 6.93" }), + svgEl("path", { d: "M12 22v-2" }), + svgEl("path", { d: "M12 2v2" }), + svgEl("path", { d: "M14 12h8" }), + svgEl("path", { d: "m17 20.66-1-1.73" }), + svgEl("path", { d: "m17 3.34-1 1.73" }), + svgEl("path", { d: "M2 12h2" }), + svgEl("path", { d: "m20.66 17-1.73-1" }), + svgEl("path", { d: "m20.66 7-1.73 1" }), + svgEl("path", { d: "m3.34 17 1.73-1" }), + svgEl("path", { d: "m3.34 7 1.73 1" }), + svgEl("circle", { cx: "12", cy: "12", r: "2" }), + svgEl("circle", { cx: "12", cy: "12", r: "8" }) + ]); +} +function renderCopyIcon24() { + return createIcon( + "lucide lucide-copy-icon lucide-copy", [ svgEl("rect", { width: "14", @@ -2028,26 +1611,42 @@ function renderCopyIcon24() { svgEl("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }) - ] + ], + { width: "24", height: "24" } + ); +} +function renderDownloadIcon24() { + return createIcon("lucide lucide-download-icon lucide-download", [ + svgEl("path", { d: "M12 15V3" }), + svgEl("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), + svgEl("path", { d: "m7 10 5 5 5-5" }) + ]); +} +function renderGlobeIcon24() { + return createIcon( + "lucide lucide-globe-icon lucide-globe", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }), + svgEl("path", { d: "M2 12h20" }) + ], + { width: "14", height: "14" } + ); +} +function renderInfoIcon24() { + return createIcon( + "lucide lucide-info-icon lucide-info", + [ + svgEl("circle", { cx: "12", cy: "12", r: "10" }), + svgEl("path", { d: "M12 16v-4" }), + svgEl("path", { d: "M12 8h.01" }) + ], + { width: "24", height: "24" } ); } - -// src/icons/renderLinkIcon24.ts function renderLinkIcon24() { - return svgEl( - "svg", - { - xmlns: "http://www.w3.org/2000/svg", - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-link-icon lucide-link" - }, + return createIcon( + "lucide lucide-link-icon lucide-link", [ svgEl("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" @@ -2055,121 +1654,88 @@ function renderLinkIcon24() { svgEl("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }) - ] + ], + { width: "24", height: "24" } ); } - -// src/icons/renderDownloadIcon24.ts -function renderDownloadIcon24() { - const NS = "http://www.w3.org/2000/svg"; - return svgEl( - "svg", - { - xmlns: NS, - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-download-icon lucide-download" - }, +function renderLoaderCircleIcon24() { + return createIcon( + "lucide lucide-loader-circle rotate", [ - svgEl("path", { - d: "M12 15V3" - }), - svgEl("path", { - d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" - }), - svgEl("path", { - d: "m7 10 5 5 5-5" + svgEl("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }), + svgEl("animateTransform", { + attributeName: "transform", + attributeType: "XML", + type: "rotate", + from: "0 12 12", + to: "360 12 12", + dur: "1s", + repeatCount: "indefinite" }) - ] + ], + { width: "24", height: "24" } ); } - -// src/icons/renderInfoIcon24.ts -function renderInfoIcon24() { - return svgEl( - "svg", - { - xmlns: "http://www.w3.org/2000/svg", - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-info-icon lucide-info" - }, - [ - svgEl("circle", { - cx: "12", - cy: "12", - r: "10" - }), - svgEl("path", { - d: "M12 16v-4" - }), - svgEl("path", { - d: "M12 8h.01" - }) - ] - ); +function renderPauseIcon24() { + return createIcon("lucide lucide-pause-icon lucide-pause", [ + svgEl("rect", { x: "14", y: "3", width: "5", height: "18", rx: "1" }), + svgEl("rect", { x: "5", y: "3", width: "5", height: "18", rx: "1" }) + ]); } - -// src/icons/renderGlobeIcon24.ts -function renderGlobeIcon24() { - return svgEl( - "svg", - { - xmlns: "http://www.w3.org/2000/svg", - width: "14", - height: "14", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-globe-icon lucide-globe" - }, - [ - svgEl("circle", { cx: "12", cy: "12", r: "10" }), - svgEl("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }), - svgEl("path", { d: "M2 12h20" }) - ] - ); +function renderPlayIcon24() { + return createIcon("lucide lucide-play-icon lucide-play", [ + svgEl("path", { + d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" + }) + ]); +} +function renderRotateCcwIcon24() { + return createIcon("lucide lucide-rotate-ccw-icon lucide-rotate-ccw", [ + svgEl("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), + svgEl("path", { d: "M3 3v5h5" }) + ]); +} +function renderSearchIcon24() { + return createIcon("lucide lucide-search-icon lucide-search", [ + svgEl("path", { d: "m21 21-4.34-4.34" }), + svgEl("circle", { cx: "11", cy: "11", r: "8" }) + ]); } - -// src/icons/renderSendIcon24.ts function renderSendIcon24() { - return svgEl( - "svg", - { - xmlns: "http://www.w3.org/2000/svg", - width: "24", - height: "24", - viewBox: "0 0 24 24", - fill: "none", - stroke: "currentColor", - "stroke-width": "2", - "stroke-linecap": "round", - "stroke-linejoin": "round", - class: "lucide lucide-send-icon lucide-send" - }, + return createIcon( + "lucide lucide-send-icon lucide-send", [ svgEl("path", { d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" }), - svgEl("path", { - d: "m21.854 2.147-10.94 10.939" - }) - ] + svgEl("path", { d: "m21.854 2.147-10.94 10.939" }) + ], + { width: "24", height: "24" } ); } +function renderSquareChartGanttIcon24() { + return createIcon("lucide lucide-square-chart-gantt-icon lucide-square-chart-gantt", [ + svgEl("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }), + svgEl("path", { d: "M9 8h7" }), + svgEl("path", { d: "M8 12h6" }), + svgEl("path", { d: "M11 16h5" }) + ]); +} +function renderTriangleAlertIcon24() { + return createIcon("lucide lucide-triangle-alert-icon lucide-triangle-alert", [ + svgEl("path", { + d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" + }), + svgEl("path", { d: "M12 9v4" }), + svgEl("path", { d: "M12 17h.01" }) + ]); +} +function renderXIcon24() { + return createIcon("lucide lucide-x-icon lucide-x", [ + svgEl("path", { d: "M18 6 6 18" }), + svgEl("path", { d: "m6 6 12 12" }) + ]); +} // src/helpers/prettyBytes.ts function prettyBytes(n) { diff --git a/tachyon/files/usr/lib/components/updater.uc b/tachyon/files/usr/lib/components/updater.uc index b0f58ed9..af335b4a 100644 --- a/tachyon/files/usr/lib/components/updater.uc +++ b/tachyon/files/usr/lib/components/updater.uc @@ -5,28 +5,9 @@ let common = require("core.common"); let as_string = common.as_string; let read_json_file = common.read_json_file; -function read_stdin() { - let input = fs.open("/dev/stdin", "r"); - if (!input) - return ""; - let data = input.read("all"); - input.close(); - return data == null ? "" : data; -} - -function read_stdin_json() { - let data = read_stdin(); - try { - return json(data); - } - catch (e) { - return null; - } -} - -function write_json(value) { - print(sprintf("%J", value), "\n"); -} +let read_stdin = common.read_stdin; +let read_stdin_json = common.read_stdin_json; +let write_json = common.write_json; function stdin_contains_ci(needle) { needle = lc(as_string(needle)); @@ -45,14 +26,7 @@ function stdin_first_line_last_field() { print(as_string(fields[length(fields) - 1]), "\n"); } -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - exit(1); - - let newline = index(data, "\n"); - print(newline >= 0 ? substr(data, 0, newline) : data, "\n"); -} +let file_first_line = common.print_file_first_line; function json_file_field(path, key, fallback) { let value = read_json_file(path); diff --git a/tachyon/files/usr/lib/components/updates.uc b/tachyon/files/usr/lib/components/updates.uc index a190a166..75ddf09e 100644 --- a/tachyon/files/usr/lib/components/updates.uc +++ b/tachyon/files/usr/lib/components/updates.uc @@ -200,23 +200,8 @@ function write_state_file(path, value) { return true; } -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - exit(1); - - let newline = index(data, "\n"); - print(newline >= 0 ? substr(data, 0, newline) : data, "\n"); -} - -function file_first_line_value(path) { - let data = fs.readfile(path); - if (data == null) - return ""; - - let newline = index(data, "\n"); - return newline >= 0 ? substr(data, 0, newline) : data; -} +let file_first_line = common.print_file_first_line; +let file_first_line_value = common.file_first_line; function arg_bool(value) { value = lc(as_string(value)); @@ -300,9 +285,7 @@ function file_last_nonblank_line_value(path, fallback, max_chars) { return text_first_chars(result, max_chars); } -function section_name(section) { - return as_string(object_or_empty(section)[".name"]); -} +let section_name = common.section_name; function file_exists_value(path) { return fs.stat(as_string(path)) != null; diff --git a/tachyon/files/usr/lib/config/validator.uc b/tachyon/files/usr/lib/config/validator.uc index 16cd4362..6e853f27 100644 --- a/tachyon/files/usr/lib/config/validator.uc +++ b/tachyon/files/usr/lib/config/validator.uc @@ -645,33 +645,7 @@ function mwan3_is_active() { command_success_from_args([ "/etc/init.d/mwan3", "enabled" ]); } -function hex_digit_value(value) { - let pos = index("0123456789abcdef", lc(as_string(value))); - return pos >= 0 ? pos : null; -} - -function parse_number(value) { - value = lc(trim(as_string(value))); - if (value == "") - return null; - - if (substr(value, 0, 2) == "0x") { - value = substr(value, 2); - if (value == "") - return null; - - let result = 0; - for (let i = 0; i < length(value); i++) { - let digit = hex_digit_value(substr(value, i, 1)); - if (digit == null) - return null; - result = result * 16 + digit; - } - return result; - } - - return match(value, /^[0-9]+$/) == null ? null : int(value); -} +let parse_number = common.parse_number; function subscription_parser() { if (subscription_parser_module == null) @@ -764,9 +738,7 @@ function sections_by_type(type_name) { return result; } -function section_name(section) { - return option(section, ".name", ""); -} +let section_name = common.section_name; function section_enabled(section) { return bool_option(section, "enabled", true); diff --git a/tachyon/files/usr/lib/core/common.uc b/tachyon/files/usr/lib/core/common.uc index 180c1d71..6f41e0ee 100644 --- a/tachyon/files/usr/lib/core/common.uc +++ b/tachyon/files/usr/lib/core/common.uc @@ -599,8 +599,68 @@ function get_mixed_port() { return info ? info.port : 4534; } +function hex_digit_value(value) { + let pos = index("0123456789abcdef", lc(as_string(value))); + return pos >= 0 ? pos : null; +} + +function parse_number(value) { + value = lc(trim(as_string(value))); + if (value == "") + return null; + + if (substr(value, 0, 2) == "0x") { + value = substr(value, 2); + if (value == "") + return null; + + let result = 0; + for (let i = 0; i < length(value); i++) { + let digit = hex_digit_value(substr(value, i, 1)); + if (digit == null) + return null; + result = result * 16 + digit; + } + return result; + } + + return match(value, /^[0-9]+$/) == null ? null : int(value, 10); +} + +function file_first_line(path) { + let data = fs.readfile(as_string(path)); + if (data == null) + return ""; + let newline = index(data, "\n"); + return trim(newline >= 0 ? substr(data, 0, newline) : data); +} + +function print_file_first_line(path) { + let data = fs.readfile(as_string(path)); + if (data == null) + exit(1); + let newline = index(data, "\n"); + print(newline >= 0 ? substr(data, 0, newline) : data, "\n"); +} + +function section_name(section) { + return as_string(object_or_empty(section)[".name"]); +} + +function log_message(message, level, tag) { + level = as_string(level || "info"); + tag = as_string(tag || "tachyon"); + command_success_from_args([ "logger", "-t", tag, "[" + level + "] " + as_string(message) ]); +} + return { as_string, + hex_digit_value, + parse_number, + file_first_line, + print_file_first_line, + section_name, + log_message, read_json_file, read_stdin, read_stdin_json, diff --git a/tachyon/files/usr/lib/diagnostics/status.uc b/tachyon/files/usr/lib/diagnostics/status.uc index da76dc4b..b99b403d 100644 --- a/tachyon/files/usr/lib/diagnostics/status.uc +++ b/tachyon/files/usr/lib/diagnostics/status.uc @@ -1553,19 +1553,10 @@ function render_tachyon_logs() { } function file_first_line(path, fallback) { - let data = fs.readfile(path); - let result = ""; - - if (data != null) { - let lines = split(as_string(data), "\n"); - if (length(lines) > 0) - result = str_remove_suffix(as_string(lines[0]), "\r"); - } - - if (result == "") - result = as_string(fallback); - - print_line(result); + let line = common.file_first_line(path); + if (line == "") + line = as_string(fallback); + print_line(line); } function js_var_string_value(path, var_name) { diff --git a/tachyon/files/usr/lib/nft/apply.uc b/tachyon/files/usr/lib/nft/apply.uc index 2c81d433..97eaee5a 100644 --- a/tachyon/files/usr/lib/nft/apply.uc +++ b/tachyon/files/usr/lib/nft/apply.uc @@ -1742,33 +1742,7 @@ function nft_create_runtime_output_rules(table, localv4_set, common_set, port_se ); } -function hex_digit_value(value) { - let pos = index("0123456789abcdef", lc(as_string(value))); - return pos >= 0 ? pos : null; -} - -function parse_mark_number(value) { - value = lc(trim(as_string(value))); - if (value == "") - return null; - - if (substr(value, 0, 2) == "0x") { - value = substr(value, 2); - if (value == "") - return null; - - let result = 0; - for (let i = 0; i < length(value); i++) { - let digit = hex_digit_value(substr(value, i, 1)); - if (digit == null) - return null; - result = result * 16 + digit; - } - return result; - } - - return match(value, /^[0-9]+$/) == null ? null : int(value); -} +let parse_mark_number = common.parse_number; function nft_provider_mark_hex(route_mark_base, index) { let base = parse_mark_number(route_mark_base); diff --git a/tachyon/files/usr/lib/providers/byedpi/runtime.uc b/tachyon/files/usr/lib/providers/byedpi/runtime.uc index 5cb93a2e..00949b2e 100644 --- a/tachyon/files/usr/lib/providers/byedpi/runtime.uc +++ b/tachyon/files/usr/lib/providers/byedpi/runtime.uc @@ -38,19 +38,9 @@ function command_exists(name) { return command_success_from_args([ "command", "-v", name ]); } -function log_message(message, level) { - level = as_string(level || "info"); - command_success_from_args([ "logger", "-t", "tachyon", "[" + level + "] " + as_string(message) ]); -} - -function bool_option(section, key, fallback) { - let value = object_or_empty(section)[key]; - return value == null ? !!fallback : bool_value(value); -} - -function section_name(section) { - return as_string(object_or_empty(section)[".name"]); -} +let log_message = common.log_message; +let bool_option = common.bool_option; +let section_name = common.section_name; function uci_sections(type_name) { return uci_core.section_objects(CONFIG_NAME, as_string(type_name)); @@ -185,13 +175,7 @@ function runtime_pid_running(pid) { return match(pid, /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ]); } -function file_first_line(path) { - let data = fs.readfile(as_string(path)); - if (data == null) - return ""; - let newline = index(data, "\n"); - return trim(newline >= 0 ? substr(data, 0, newline) : data); -} +let file_first_line = common.file_first_line; function kill_pidfile_process(path, signal) { let pid = file_first_line(path); diff --git a/tachyon/files/usr/lib/providers/nfqueue/runtime.uc b/tachyon/files/usr/lib/providers/nfqueue/runtime.uc index 14cb20d0..fbbca0c0 100644 --- a/tachyon/files/usr/lib/providers/nfqueue/runtime.uc +++ b/tachyon/files/usr/lib/providers/nfqueue/runtime.uc @@ -36,19 +36,9 @@ function module_success(args) { return command_success(module_command(args)); } -function log_message(message, level) { - level = as_string(level || "info"); - command_success_from_args([ "logger", "-t", "tachyon", "[" + level + "] " + as_string(message) ]); -} - -function bool_option(section, key, fallback) { - let value = object_or_empty(section)[key]; - return value == null ? !!fallback : bool_value(value); -} - -function section_name(section) { - return as_string(object_or_empty(section)[".name"]); -} +let log_message = common.log_message; +let bool_option = common.bool_option; +let section_name = common.section_name; function uci_sections(type_name) { return uci_core.section_objects(CONFIG_NAME, as_string(type_name)); @@ -94,28 +84,7 @@ function enabled_sections(cfg) { return result; } -function hex_digit_value(value) { - let pos = index("0123456789abcdef", lc(as_string(value))); - return pos >= 0 ? pos : null; -} - -function parse_number(value) { - value = lc(trim(as_string(value))); - if (value == "") - return null; - if (substr(value, 0, 2) == "0x") { - value = substr(value, 2); - let result = 0; - for (let i = 0; i < length(value); i++) { - let digit = hex_digit_value(substr(value, i, 1)); - if (digit == null) - return null; - result = result * 16 + digit; - } - return result; - } - return match(value, /^[0-9]+$/) == null ? null : int(value); -} +let parse_number = common.parse_number; function route_mark_value(cfg, index_value) { return parse_number(cfg.route_mark_base) + int(index_value); @@ -185,13 +154,7 @@ function runtime_pid_running(pid) { return match(pid, /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ]); } -function file_first_line(path) { - let data = fs.readfile(as_string(path)); - if (data == null) - return ""; - let newline = index(data, "\n"); - return trim(newline >= 0 ? substr(data, 0, newline) : data); -} +let file_first_line = common.file_first_line; function kill_pidfile_process(path, signal) { let pid = file_first_line(path); diff --git a/tachyon/files/usr/lib/providers/olcrtc/runtime.uc b/tachyon/files/usr/lib/providers/olcrtc/runtime.uc index 0bd67e84..409c01c4 100644 --- a/tachyon/files/usr/lib/providers/olcrtc/runtime.uc +++ b/tachyon/files/usr/lib/providers/olcrtc/runtime.uc @@ -22,61 +22,15 @@ function log_message(msg, level) { system("logger -t " + MODE + " -p " + (level == "fatal" ? "user.err" : level == "warn" ? "user.warning" : "user.info") + " '" + msg + "'"); } -function command_from_args(args) { - let parts = []; - for (let arg in args) - push(parts, common.shell_quote(as_string(arg))); - return join(" ", parts); -} - -function command_output(cmd) { - let output = trim(popen(cmd, "r") || ""); - return output; -} - -function command_output_from_args(args) { - return command_output(command_from_args(args)); -} - -function command_success_from_args(args) { - return system(command_from_args(args)) == 0; -} - -function option(section, key, fallback) { - let val = section[key]; - if (val == null) - return fallback || ""; - if (type(val) == "array") - return join(" ", val); - return as_string(val); -} - -function bool_option(section, key, fallback) { - let val = section[key]; - if (val == null) - return fallback || false; - return bool_value(val); -} - -function list_option(section, key) { - let val = section[key]; - if (val == null) - return []; - if (type(val) == "array") - return val; - return split(trim(as_string(val)), " \t\n\r"); -} - -function section_name(section) { - return as_string(section[".name"] || ""); -} - -function read_json_file(path) { - let data = fs.readfile(path); - if (data == null || data == "") - return null; - return json(data); -} +let command_from_args = common.command_from_args; +let command_output = common.command_output; +let command_output_from_args = common.command_output_from_args; +let command_success_from_args = common.command_success_from_args; +let option = common.option; +let bool_option = common.bool_option; +let list_option = common.list_option; +let section_name = common.section_name; +let read_json_file = common.read_json_file; function yaml_quote(value) { value = as_string(value); diff --git a/tachyon/files/usr/lib/providers/rules.uc b/tachyon/files/usr/lib/providers/rules.uc index bfde80df..186deddb 100644 --- a/tachyon/files/usr/lib/providers/rules.uc +++ b/tachyon/files/usr/lib/providers/rules.uc @@ -10,33 +10,7 @@ let bool_value = common.bool_value; const CONFIG_NAME = getenv("TACHYON_CONFIG_NAME") || "tachyon"; -function hex_digit_value(value) { - let pos = index("0123456789abcdef", lc(as_string(value))); - return pos >= 0 ? pos : null; -} - -function parse_number(value) { - value = lc(trim(as_string(value))); - if (value == "") - return null; - - if (substr(value, 0, 2) == "0x") { - value = substr(value, 2); - if (value == "") - return null; - - let result = 0; - for (let i = 0; i < length(value); i++) { - let digit = hex_digit_value(substr(value, i, 1)); - if (digit == null) - return null; - result = result * 16 + digit; - } - return result; - } - - return match(value, /^[0-9]+$/) == null ? null : int(value); -} +let parse_number = common.parse_number; function rule_rows() { let rows = []; diff --git a/tachyon/files/usr/lib/providers/wdtt/runtime.uc b/tachyon/files/usr/lib/providers/wdtt/runtime.uc index c3acc364..2875fa49 100644 --- a/tachyon/files/usr/lib/providers/wdtt/runtime.uc +++ b/tachyon/files/usr/lib/providers/wdtt/runtime.uc @@ -22,71 +22,16 @@ function log_message(msg, level) { system("logger -t " + MODE + " -p " + (level == "fatal" ? "user.err" : level == "warn" ? "user.warning" : "user.info") + " '" + msg + "'"); } -function command_from_args(args) { - let parts = []; - for (let arg in args) - push(parts, common.shell_quote(as_string(arg))); - return join(" ", parts); -} - -function command_output(cmd) { - let output = trim(popen(cmd, "r") || ""); - return output; -} - -function command_output_from_args(args) { - return command_output(command_from_args(args)); -} - -function command_success_from_args(args) { - return system(command_from_args(args)) == 0; -} - -function option(section, key, fallback) { - let val = section[key]; - if (val == null) - return fallback || ""; - if (type(val) == "array") - return join(" ", val); - return as_string(val); -} - -function bool_option(section, key, fallback) { - let val = section[key]; - if (val == null) - return fallback || false; - return bool_value(val); -} - -function list_option(section, key) { - let val = section[key]; - if (val == null) - return []; - if (type(val) == "array") - return val; - return split(trim(as_string(val)), " \t\n\r"); -} - -function section_name(section) { - return as_string(section[".name"] || ""); -} - -function read_json_file(path) { - let data = fs.readfile(path); - if (data == null || data == "") - return null; - return json(data); -} - -function write_json_file(path, data) { - let tmp = path + ".tmp"; - let f = fs.open(tmp, "w"); - if (!f) - return false; - f.write(sprintf("%J", data)); - f.close(); - return rename(tmp, path) == 0; -} +let command_from_args = common.command_from_args; +let command_output = common.command_output; +let command_output_from_args = common.command_output_from_args; +let command_success_from_args = common.command_success_from_args; +let option = common.option; +let bool_option = common.bool_option; +let list_option = common.list_option; +let section_name = common.section_name; +let read_json_file = common.read_json_file; +let write_json_file = common.write_json_file; function lan_mac_address() { for (let iface in ["br-lan", "lan", "eth0", "eth1"]) { diff --git a/tachyon/files/usr/lib/server/service.uc b/tachyon/files/usr/lib/server/service.uc index c5fc4954..19c1e779 100644 --- a/tachyon/files/usr/lib/server/service.uc +++ b/tachyon/files/usr/lib/server/service.uc @@ -15,11 +15,7 @@ let write_json = common.write_json; const CONFIG_NAME = getenv("TACHYON_CONFIG_NAME") || "tachyon"; function ascii_lower(value) { - let upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - let lower = "abcdefghijklmnopqrstuvwxyz"; - return replace(as_string(value), /[A-Z]/g, function(ch) { - return substr(lower, index(upper, ch), 1); - }); + return lc(as_string(value)); } function run(command) { @@ -262,14 +258,7 @@ function mtproto_base_secret_from_value(value) { print(result, "\n"); } -function hex_digit_value(value) { - value = ord(lc(as_string(value))); - if (value >= 48 && value <= 57) - return value - 48; - if (value >= 97 && value <= 102) - return value - 87; - return -1; -} +let hex_digit_value = common.hex_digit_value; function hex_to_string_value(value) { value = as_string(value); @@ -280,7 +269,7 @@ function hex_to_string_value(value) { for (let i = 0; i < length(value); i += 2) { let high = hex_digit_value(substr(value, i, 1)); let low = hex_digit_value(substr(value, i + 1, 1)); - if (high < 0 || low < 0) + if (high == null || low == null) return null; result += chr(high * 16 + low); } diff --git a/tachyon/files/usr/lib/service/state.uc b/tachyon/files/usr/lib/service/state.uc index a642d271..55fc76fd 100644 --- a/tachyon/files/usr/lib/service/state.uc +++ b/tachyon/files/usr/lib/service/state.uc @@ -85,15 +85,7 @@ function uci_exists(path) { } let object_or_empty = common.object_or_empty; - -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - exit(1); - - let newline = index(data, "\n"); - print(newline >= 0 ? substr(data, 0, newline) : data, "\n"); -} +let file_first_line = common.print_file_first_line; function read_state_value(path, needle) { let data = fs.readfile(path); @@ -704,9 +696,7 @@ function bool_option_value(section, key, fallback) { return bool_option(section, key, fallback) ? "1" : "0"; } -function section_name(section) { - return as_string(object_or_empty(section)[".name"]); -} +let section_name = common.section_name; function str_startswith(value, prefix) { value = as_string(value); diff --git a/tachyon/files/usr/lib/singbox/dns_failover.uc b/tachyon/files/usr/lib/singbox/dns_failover.uc index a90e0ac6..6ca1dae3 100644 --- a/tachyon/files/usr/lib/singbox/dns_failover.uc +++ b/tachyon/files/usr/lib/singbox/dns_failover.uc @@ -27,9 +27,7 @@ function settings() { return common.object_or_empty(uci_core.get_all(CONFIG_NAME, "settings")); } -function ensure_dir(path) { - return command_success_from_args([ "mkdir", "-p", path ]); -} +let ensure_dir = common.ensure_dir; function write_state(path, value) { if (!ensure_dir(RUNTIME_STATE_DIR)) @@ -345,12 +343,7 @@ function worker() { } } -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - return ""; - return trim(split(as_string(data), "\n")[0]); -} +let file_first_line = common.file_first_line; function process_running(pid) { return match(as_string(pid), /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ]); diff --git a/tachyon/files/usr/lib/singbox/priority.uc b/tachyon/files/usr/lib/singbox/priority.uc index 32fb6fc0..8df81d43 100644 --- a/tachyon/files/usr/lib/singbox/priority.uc +++ b/tachyon/files/usr/lib/singbox/priority.uc @@ -23,17 +23,8 @@ const PRIORITY_PID_FILE = getenv("TACHYON_PRIORITY_PID_FILE") || RUNTIME_STATE_D const PRIORITY_UC = getenv("TACHYON_PRIORITY_UC") || LIB_DIR + "/singbox/priority.uc"; const DIAGNOSTICS_UC = getenv("TACHYON_DIAGNOSTICS_UC") || LIB_DIR + "/diagnostics/runtime.uc"; -function ensure_dir(path) { - return command_success_from_args([ "mkdir", "-p", path ]); -} - -function file_first_line(path) { - let data = fs.readfile(as_string(path)); - if (data == null) - return ""; - let newline = index(data, "\n"); - return trim(newline >= 0 ? substr(data, 0, newline) : data); -} +let ensure_dir = common.ensure_dir; +let file_first_line = common.file_first_line; function log_message(message, level) { level = as_string(level || "info"); diff --git a/tachyon/files/usr/lib/singbox/runtime.uc b/tachyon/files/usr/lib/singbox/runtime.uc index 1e0b65e8..1c60bfbc 100644 --- a/tachyon/files/usr/lib/singbox/runtime.uc +++ b/tachyon/files/usr/lib/singbox/runtime.uc @@ -85,13 +85,7 @@ function remove_files(paths) { remove_file(path); } -function file_first_line(path) { - let data = fs.readfile(as_string(path)); - if (data == null) - return ""; - let newline = index(data, "\n"); - return trim(newline >= 0 ? substr(data, 0, newline) : data); -} +let file_first_line = common.file_first_line; function arg_bool(value) { value = lc(as_string(value)); diff --git a/tachyon/files/usr/lib/singbox/subscription.uc b/tachyon/files/usr/lib/singbox/subscription.uc index 71e36bbe..543de9cf 100644 --- a/tachyon/files/usr/lib/singbox/subscription.uc +++ b/tachyon/files/usr/lib/singbox/subscription.uc @@ -62,14 +62,7 @@ function parse_source_entry(entry) { }; } -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - return ""; - - let newline = index(data, "\n"); - return newline >= 0 ? substr(data, 0, newline) : data; -} +let file_first_line = common.file_first_line; function valid_metadata_object(value) { return type(value) == "object" && object_key_count(value) > 1; diff --git a/tachyon/files/usr/lib/subscription/cache.uc b/tachyon/files/usr/lib/subscription/cache.uc index 6d1ae257..1c80968e 100644 --- a/tachyon/files/usr/lib/subscription/cache.uc +++ b/tachyon/files/usr/lib/subscription/cache.uc @@ -89,23 +89,8 @@ function write_stdout_json(value) { print(sprintf("%J", value), "\n"); } -function file_first_line(path) { - let data = fs.readfile(path); - if (data == null) - exit(1); - - let newline = index(data, "\n"); - print(newline >= 0 ? substr(data, 0, newline) : data, "\n"); -} - -function file_first_line_value(path) { - let data = fs.readfile(path); - if (data == null) - return ""; - - let newline = index(data, "\n"); - return newline >= 0 ? substr(data, 0, newline) : data; -} +let file_first_line = common.print_file_first_line; +let file_first_line_value = common.file_first_line; function file_has_exact_line(path, needle) { let data = fs.readfile(path); @@ -249,9 +234,7 @@ function append_word_once(words, value) { return words + (words != "" ? " " : "") + value; } -function section_name(section) { - return as_string(object_or_empty(section)[".name"]); -} +let section_name = common.section_name; function source_id(section, index) { return as_string(section) + "-subscription-" + as_string(index);