mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 05:20:46 +08:00
34 lines
2 KiB
JavaScript
34 lines
2 KiB
JavaScript
export const SLACK_STYLE_ID = 'xmanrui-dsh-im-slack-settings';
|
|
|
|
const CSS = String.raw`
|
|
.dsl-page { --ddt-accent: #4a154b; --ddt-accent-deep: #321033; --ddt-accent-wash: #f7eef7; }
|
|
.dsl-avatar { color: #fff; background: #4a154b; }
|
|
.dsl-avatar svg { display: block; }
|
|
.dsl-setup { display: grid; gap: 18px; }
|
|
.dsl-guide { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 18px; padding: 16px; border: 1px solid color-mix(in srgb, #4a154b 18%, var(--dsw-alias-border-l2, #e5e6eb)); border-radius: 11px; background: color-mix(in srgb, #4a154b 4%, var(--dsw-alias-bg-layer-1, #fff)); }
|
|
.dsl-guideCopy { min-width: 0; }
|
|
.dsl-guideCopy strong { display: block; margin-bottom: 5px; color: var(--dsw-alias-label-primary, #1f2329); font-size: 13px; }
|
|
.dsl-guideCopy p { margin: 0; color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 1.6; }
|
|
.dsl-guideActions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
.dsl-guideActions .ddt-button { white-space: nowrap; }
|
|
.dsl-copyState { color: var(--dsw-alias-state-success-primary, #20a162); }
|
|
.dsl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
|
.dsl-tokenHint { grid-column: 1 / -1; margin: -4px 0 0; color: var(--dsw-alias-label-tertiary, #8f959e); font-size: 11px; line-height: 1.55; }
|
|
@container (max-width: 680px) {
|
|
.dsl-guide { grid-template-columns: minmax(0, 1fr); }
|
|
.dsl-guideActions { justify-content: flex-start; }
|
|
.dsl-fields { grid-template-columns: minmax(0, 1fr); }
|
|
}
|
|
`;
|
|
|
|
export function installSlackStyles() {
|
|
if (typeof document === 'undefined') return () => {};
|
|
const existing = document.querySelector(`style[data-plugin-css="${SLACK_STYLE_ID}"]`);
|
|
if (existing) return () => {};
|
|
const style = document.createElement('style');
|
|
style.dataset.plugin = '@xmanrui/dsh-im';
|
|
style.dataset.pluginCss = SLACK_STYLE_ID;
|
|
style.textContent = CSS;
|
|
document.head.appendChild(style);
|
|
return () => style.remove();
|
|
}
|