@dataengineeringformachinelearning/viking-ui 4.0.4 → 4.0.6
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/README.md +35 -11
- package/dist/README.md +35 -11
- package/dist/design-tokens.css +300 -85
- package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +100 -64
- package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +1 -1
- package/dist/icons.js +306 -0
- package/dist/package.json +24 -5
- package/{src/lib/site-drakkar/site-drakkar.config.ts → dist/site-drakkar.js} +64 -130
- package/dist/src/tokens/viking-tokens.json +9 -7
- package/dist/types/dataengineeringformachinelearning-viking-ui.d.ts +97 -3
- package/dist/viking-components.css +161 -70
- package/dist/viking-tokens.json +9 -7
- package/dist/viking-ui-elements.js +44 -32
- package/dist/viking-ui.css +1 -1
- package/dist/web-components.js +44 -32
- package/package.json +30 -8
- package/dist/scripts/build-web-components.mjs +0 -37
- package/dist/src/web/badge/viking-badge-wc.ts +0 -116
- package/dist/src/web/button/viking-button-wc.ts +0 -165
- package/dist/src/web/callout/viking-callout-wc.ts +0 -105
- package/dist/src/web/card/viking-card-wc.ts +0 -67
- package/dist/src/web/core/base.ts +0 -56
- package/dist/src/web/core/dom.ts +0 -53
- package/dist/src/web/core/icons-inline.ts +0 -44
- package/dist/src/web/core/styles.ts +0 -1261
- package/dist/src/web/core/types.ts +0 -19
- package/dist/src/web/field/viking-field-wc.ts +0 -154
- package/dist/src/web/index.ts +0 -73
- package/dist/src/web/input/viking-input-wc.ts +0 -211
- package/dist/src/web/modal/viking-modal-wc.ts +0 -187
- package/dist/src/web/search-palette/viking-search-palette-wc.ts +0 -495
- package/dist/src/web/select/viking-select-wc.ts +0 -218
- package/dist/src/web/suite-header/viking-suite-header-wc.ts +0 -729
- package/dist/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
- package/dist/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
- package/dist/src/web/types.ts +0 -37
- package/dist/src/web/web-components.spec.ts +0 -297
- package/src/assets/drakkar-favicon.svg +0 -17
- package/src/assets/fonts/inter/InterVariable-Italic.woff2 +0 -0
- package/src/assets/fonts/inter/InterVariable.woff2 +0 -0
- package/src/core/brand/deml-lockup.svg +0 -5
- package/src/core/brand/deml-mark-compact.svg +0 -4
- package/src/core/brand/deml-mark-filled.svg +0 -3
- package/src/core/brand/deml-mark-outline.svg +0 -4
- package/src/core/brand-icons.ts +0 -62
- package/src/core/icons.spec.ts +0 -52
- package/src/core/icons.ts +0 -206
- package/src/core/integration-brand-icons.ts +0 -77
- package/src/core/lucide-paths.generated.ts +0 -130
- package/src/core/types.ts +0 -85
- package/src/core/uid.ts +0 -7
- package/src/elements/button/viking-button.ts +0 -201
- package/src/elements/card/viking-card.ts +0 -60
- package/src/elements/core/dom.ts +0 -33
- package/src/elements/core/styles.ts +0 -28
- package/src/elements/modal/viking-modal.ts +0 -154
- package/src/index.ts +0 -1
- package/src/lib/accordion/accordion.ts +0 -126
- package/src/lib/app-header/app-header.scss +0 -274
- package/src/lib/app-header/app-header.ts +0 -43
- package/src/lib/app-sidebar/app-sidebar.scss +0 -415
- package/src/lib/app-sidebar/app-sidebar.ts +0 -29
- package/src/lib/auth-panel/auth-panel.spec.ts +0 -132
- package/src/lib/auth-panel/auth-panel.ts +0 -228
- package/src/lib/autocomplete/autocomplete.ts +0 -223
- package/src/lib/avatar/avatar.ts +0 -126
- package/src/lib/badge/badge.ts +0 -182
- package/src/lib/bar/bar.ts +0 -31
- package/src/lib/brand/brand.ts +0 -60
- package/src/lib/breadcrumbs/breadcrumbs.ts +0 -81
- package/src/lib/button/button-group.ts +0 -40
- package/src/lib/button/button.scss +0 -119
- package/src/lib/button/button.ts +0 -98
- package/src/lib/calendar/calendar.ts +0 -253
- package/src/lib/callout/callout.ts +0 -211
- package/src/lib/card/card-title.spec.ts +0 -27
- package/src/lib/card/card-title.ts +0 -50
- package/src/lib/card/card.ts +0 -200
- package/src/lib/carousel/carousel.ts +0 -206
- package/src/lib/chart/chart-zoom.spec.ts +0 -65
- package/src/lib/chart/chart-zoom.ts +0 -71
- package/src/lib/chart/chart.ts +0 -1257
- package/src/lib/chart-card-header/chart-card-header.ts +0 -80
- package/src/lib/chart-empty-state/chart-empty-state.ts +0 -146
- package/src/lib/chart-panel/chart-panel.ts +0 -133
- package/src/lib/checkbox/checkbox.ts +0 -139
- package/src/lib/color-picker/color-picker.ts +0 -148
- package/src/lib/command/command.ts +0 -260
- package/src/lib/composer/composer.ts +0 -180
- package/src/lib/confirm-dialog/confirm-dialog.ts +0 -163
- package/src/lib/confirm-dialog/dialog.service.ts +0 -79
- package/src/lib/context/context.ts +0 -75
- package/src/lib/core/brand-icons.ts +0 -62
- package/src/lib/core/cva.ts +0 -33
- package/src/lib/core/icons.ts +0 -206
- package/src/lib/core/integration-brand-icons.ts +0 -77
- package/src/lib/core/lucide-paths.generated.ts +0 -130
- package/src/lib/date-picker/date-picker.ts +0 -139
- package/src/lib/dropdown/dropdown.ts +0 -188
- package/src/lib/editor/editor.ts +0 -170
- package/src/lib/empty-state/empty-state.ts +0 -100
- package/src/lib/fab/fab.ts +0 -76
- package/src/lib/field/field.ts +0 -111
- package/src/lib/file-upload/file-upload.ts +0 -208
- package/src/lib/footer/footer.scss +0 -162
- package/src/lib/footer/footer.ts +0 -28
- package/src/lib/form-section/form-section.ts +0 -200
- package/src/lib/forms.spec.ts +0 -92
- package/src/lib/gauge-arc/gauge-arc.ts +0 -85
- package/src/lib/hud-panel/hud-panel.ts +0 -27
- package/src/lib/icon/icon.ts +0 -284
- package/src/lib/icon-badge/icon-badge.ts +0 -87
- package/src/lib/icon-heading/icon-heading.spec.ts +0 -32
- package/src/lib/icon-heading/icon-heading.ts +0 -38
- package/src/lib/icon-text/icon-text.ts +0 -120
- package/src/lib/input/input.ts +0 -119
- package/src/lib/kanban/kanban.ts +0 -211
- package/src/lib/kbd/kbd.ts +0 -32
- package/src/lib/label/label.ts +0 -39
- package/src/lib/loading-overlay/loading-overlay.ts +0 -80
- package/src/lib/menubar/menubar.ts +0 -77
- package/src/lib/metric-card/metric-card.ts +0 -33
- package/src/lib/modal/modal.ts +0 -207
- package/src/lib/native-select/native-select.ts +0 -124
- package/src/lib/navbar/navbar.ts +0 -124
- package/src/lib/navigation-menu/navigation-menu.ts +0 -116
- package/src/lib/otp-input/otp-input.ts +0 -164
- package/src/lib/page-back-link/page-back-link.ts +0 -74
- package/src/lib/page-header/page-header.ts +0 -70
- package/src/lib/pagination/pagination.ts +0 -157
- package/src/lib/pillbox/pillbox.ts +0 -157
- package/src/lib/popover/popover.ts +0 -92
- package/src/lib/profile/profile.ts +0 -73
- package/src/lib/progress/progress.ts +0 -123
- package/src/lib/radio/radio.ts +0 -132
- package/src/lib/ring-gauge/ring-gauge.ts +0 -75
- package/src/lib/scroll-area/scroll-area.ts +0 -57
- package/src/lib/search-palette/search-palette.scss +0 -288
- package/src/lib/search-palette/search-palette.ts +0 -114
- package/src/lib/select/select.ts +0 -292
- package/src/lib/separator/separator.ts +0 -59
- package/src/lib/sheet/sheet.ts +0 -192
- package/src/lib/sidebar-nav/sidebar-nav.scss +0 -218
- package/src/lib/sidebar-nav/sidebar-nav.ts +0 -158
- package/src/lib/site-drakkar/site-footer.ts +0 -133
- package/src/lib/site-drakkar/site-navbar.scss +0 -2
- package/src/lib/site-drakkar/site-navbar.ts +0 -286
- package/src/lib/site-drakkar/suite-search-items.spec.ts +0 -61
- package/src/lib/site-drakkar/suite-search-items.ts +0 -246
- package/src/lib/skeleton/skeleton.ts +0 -51
- package/src/lib/slider/slider.ts +0 -133
- package/src/lib/spinner/spinner.ts +0 -75
- package/src/lib/status-metric-row/status-metric-row.ts +0 -74
- package/src/lib/suite-search-palette/suite-search-palette.ts +0 -95
- package/src/lib/switch/switch.ts +0 -131
- package/src/lib/table/table.ts +0 -137
- package/src/lib/tabs/tab-panel.ts +0 -61
- package/src/lib/tabs/tab.ts +0 -107
- package/src/lib/tabs/tabs.ts +0 -109
- package/src/lib/textarea/textarea.ts +0 -103
- package/src/lib/theme-toggle/theme-toggle.spec.ts +0 -40
- package/src/lib/theme-toggle/theme-toggle.ts +0 -40
- package/src/lib/time-picker/time-picker.ts +0 -197
- package/src/lib/timeline/timeline.ts +0 -152
- package/src/lib/toast/toast.ts +0 -196
- package/src/lib/toggle/toggle-group.ts +0 -60
- package/src/lib/toggle/toggle.ts +0 -101
- package/src/lib/tooltip/tooltip.ts +0 -119
- package/src/lib/typography/heading.ts +0 -52
- package/src/lib/typography/text.ts +0 -51
- package/src/lib/uptime-bar/uptime-bar.ts +0 -55
- package/src/lib/verification-code-field/verification-code-field.ts +0 -149
- package/src/lib/whitepaper-cta/whitepaper-cta.scss +0 -130
- package/src/lib/whitepaper-cta/whitepaper-cta.ts +0 -78
- package/src/lib/wizard/wizard.ts +0 -80
- package/src/public-api.ts +0 -172
- package/src/styles/_buttons.scss +0 -386
- package/src/styles/_component-primitives.scss +0 -183
- package/src/styles/_drakkar-buttons.scss +0 -85
- package/src/styles/_fonts.scss +0 -22
- package/src/styles/_forms.scss +0 -66
- package/src/styles/_input.scss +0 -106
- package/src/styles/_layout-enforcement.scss +0 -229
- package/src/styles/_layout-rhythm.scss +0 -158
- package/src/styles/_legacy-aliases.scss +0 -212
- package/src/styles/_series-colors.scss +0 -24
- package/src/styles/_static-primitives.scss +0 -857
- package/src/styles/_typography.scss +0 -87
- package/src/styles/_variables.scss +0 -527
- package/src/styles/components/a11y.scss +0 -90
- package/src/styles/components/badges.scss +0 -102
- package/src/styles/components/extracted-utilities.scss +0 -459
- package/src/styles/components/footer.scss +0 -168
- package/src/styles/components/icon-heading.scss +0 -47
- package/src/styles/components/icon-inline.scss +0 -101
- package/src/styles/components/layout.scss +0 -59
- package/src/styles/components/utilities.scss +0 -131
- package/src/styles/components/viking-inspired.scss +0 -204
- package/src/styles/components/whitepaper-cta.scss +0 -130
- package/src/styles/components-bundle.scss +0 -9
- package/src/styles/components.scss +0 -442
- package/src/styles/deml-components.scss +0 -10
- package/src/styles/index.scss +0 -8
- package/src/styles/layout-shell.scss +0 -111
- package/src/styles/page-shell.scss +0 -859
- package/src/styles/static-navbar.scss +0 -1250
- package/src/styles/surfaces/backend.scss +0 -154
- package/src/styles/surfaces/docs-global.scss +0 -73
- package/src/styles/surfaces/docs-shell.scss +0 -437
- package/src/styles/surfaces/docs-showcase.scss +0 -1153
- package/src/styles/surfaces/marketing-cta.scss +0 -62
- package/src/styles/surfaces/marketing-docs-bento.scss +0 -67
- package/src/styles/surfaces/marketing-global.scss +0 -748
- package/src/styles/surfaces/marketing-landing.scss +0 -1526
- package/src/styles/surfaces/marketing-publication.scss +0 -535
- package/src/styles/surfaces/marketing-theme.scss +0 -14
- package/src/styles/surfaces/swagger-ui.scss +0 -1013
- package/src/styles/tokens-export.scss +0 -18
- package/src/styles/tokens.scss +0 -5
- package/src/styles/viking-ui-bundle.scss +0 -23
- package/src/styles/viking-ui.scss +0 -272
- package/src/tokens/series-presets.ts +0 -15
- package/src/tokens/tailwind.preset.js +0 -209
- package/src/tokens/viking-tokens.json +0 -318
- package/src/viking-ui.spec.ts +0 -416
- package/src/web/badge/viking-badge-wc.ts +0 -116
- package/src/web/button/viking-button-wc.ts +0 -165
- package/src/web/callout/viking-callout-wc.ts +0 -105
- package/src/web/card/viking-card-wc.ts +0 -67
- package/src/web/core/base.ts +0 -56
- package/src/web/core/dom.ts +0 -53
- package/src/web/core/icons-inline.ts +0 -44
- package/src/web/core/styles.ts +0 -1261
- package/src/web/core/types.ts +0 -19
- package/src/web/field/viking-field-wc.ts +0 -154
- package/src/web/index.ts +0 -73
- package/src/web/input/viking-input-wc.ts +0 -211
- package/src/web/modal/viking-modal-wc.ts +0 -187
- package/src/web/search-palette/viking-search-palette-wc.ts +0 -495
- package/src/web/select/viking-select-wc.ts +0 -218
- package/src/web/suite-header/viking-suite-header-wc.ts +0 -729
- package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
- package/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
- package/src/web/types.ts +0 -37
- package/src/web/web-components.spec.ts +0 -297
- package/src/web-components/index.ts +0 -1
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_SITE_URLS,
|
|
3
|
-
type SiteDrakkarContext,
|
|
4
|
-
type SiteUrls,
|
|
5
|
-
} from "../../lib/site-drakkar/site-drakkar.config";
|
|
6
|
-
import { buildSuiteSearchItems } from "../../lib/site-drakkar/suite-search-items";
|
|
7
|
-
import { readBoolAttr } from "../core/base";
|
|
8
|
-
import {
|
|
9
|
-
defineCustomElement,
|
|
10
|
-
defineCustomElementAlias,
|
|
11
|
-
HTMLElementBase,
|
|
12
|
-
} from "../core/dom";
|
|
13
|
-
import {
|
|
14
|
-
VikingSearchPaletteWc,
|
|
15
|
-
registerVikingSearchPaletteWc,
|
|
16
|
-
type VikingSearchPaletteItem,
|
|
17
|
-
} from "../search-palette/viking-search-palette-wc";
|
|
18
|
-
|
|
19
|
-
const VALID_CONTEXTS = new Set<SiteDrakkarContext>([
|
|
20
|
-
"app",
|
|
21
|
-
"marketing",
|
|
22
|
-
"backend",
|
|
23
|
-
"docs",
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const detectContext = (): SiteDrakkarContext => {
|
|
27
|
-
const explicit = document.documentElement.getAttribute("data-deml-context");
|
|
28
|
-
if (explicit && VALID_CONTEXTS.has(explicit as SiteDrakkarContext)) {
|
|
29
|
-
return explicit as SiteDrakkarContext;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const host = window.location.hostname;
|
|
33
|
-
if (host.startsWith("ui.")) {
|
|
34
|
-
return "docs";
|
|
35
|
-
}
|
|
36
|
-
if (host.includes("deml.app") && !host.startsWith("backend.")) {
|
|
37
|
-
return "app";
|
|
38
|
-
}
|
|
39
|
-
if (host.startsWith("backend.")) {
|
|
40
|
-
return "backend";
|
|
41
|
-
}
|
|
42
|
-
return "marketing";
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const readUrls = (el: HTMLElement): SiteUrls => {
|
|
46
|
-
const env = (globalThis as { __DEML?: Partial<SiteUrls> }).__DEML ?? {};
|
|
47
|
-
return {
|
|
48
|
-
app: el.getAttribute("app-url") ?? env.app ?? DEFAULT_SITE_URLS.app,
|
|
49
|
-
marketing:
|
|
50
|
-
el.getAttribute("marketing-url") ??
|
|
51
|
-
env.marketing ??
|
|
52
|
-
DEFAULT_SITE_URLS.marketing,
|
|
53
|
-
backend:
|
|
54
|
-
el.getAttribute("backend-url") ??
|
|
55
|
-
env.backend ??
|
|
56
|
-
DEFAULT_SITE_URLS.backend,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const readContext = (el: HTMLElement): SiteDrakkarContext => {
|
|
61
|
-
const raw = el.getAttribute("context");
|
|
62
|
-
if (raw && VALID_CONTEXTS.has(raw as SiteDrakkarContext)) {
|
|
63
|
-
return raw as SiteDrakkarContext;
|
|
64
|
-
}
|
|
65
|
-
return detectContext();
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Unified cross-suite command palette Web Component.
|
|
70
|
-
* Tag: `viking-suite-command-palette`
|
|
71
|
-
* Aliases: `viking-suite-search-palette`, `viking-suite-search-palette-wc`
|
|
72
|
-
*
|
|
73
|
-
* Curated ⌘K navigation for marketing, docs, deml.app, and backend surfaces.
|
|
74
|
-
* Composes `viking-command-palette` with suite links from site-drakkar config.
|
|
75
|
-
*
|
|
76
|
-
* @attr context - Surface: app | marketing | backend | docs (auto-detected when omitted)
|
|
77
|
-
* @attr app-url - Override deml.app origin
|
|
78
|
-
* @attr marketing-url - Override marketing origin
|
|
79
|
-
* @attr backend-url - Override backend origin
|
|
80
|
-
* @attr global-shortcut - Bind ⌘K / Ctrl+K (default: on)
|
|
81
|
-
* @attr placeholder - Search input placeholder
|
|
82
|
-
*
|
|
83
|
-
* @method openPalette() - Programmatically open
|
|
84
|
-
* @method closePalette() - Programmatically close
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* <viking-suite-command-palette context="marketing" global-shortcut></viking-suite-command-palette>
|
|
88
|
-
*/
|
|
89
|
-
export class VikingSuiteSearchPaletteWc extends HTMLElementBase {
|
|
90
|
-
static readonly tag = "viking-suite-command-palette";
|
|
91
|
-
static readonly searchTag = "viking-suite-search-palette";
|
|
92
|
-
static readonly legacyTag = "viking-suite-search-palette-wc";
|
|
93
|
-
|
|
94
|
-
static get observedAttributes(): string[] {
|
|
95
|
-
return [
|
|
96
|
-
"context",
|
|
97
|
-
"app-url",
|
|
98
|
-
"marketing-url",
|
|
99
|
-
"backend-url",
|
|
100
|
-
"placeholder",
|
|
101
|
-
"global-shortcut",
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private paletteEl: VikingSearchPaletteWc | null = null;
|
|
106
|
-
private itemsLoaded = false;
|
|
107
|
-
|
|
108
|
-
connectedCallback(): void {
|
|
109
|
-
registerVikingSearchPaletteWc();
|
|
110
|
-
this.ensurePalette();
|
|
111
|
-
void this.loadItems();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
attributeChangedCallback(name: string): void {
|
|
115
|
-
if (!this.isConnected) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (name === "placeholder" && this.paletteEl) {
|
|
119
|
-
const placeholder =
|
|
120
|
-
this.getAttribute("placeholder") ??
|
|
121
|
-
"Search documentation, dashboard, settings…";
|
|
122
|
-
this.paletteEl.setAttribute("placeholder", placeholder);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (name === "global-shortcut" && this.paletteEl) {
|
|
126
|
-
if (
|
|
127
|
-
readBoolAttr(this, "global-shortcut") ||
|
|
128
|
-
!this.hasAttribute("global-shortcut")
|
|
129
|
-
) {
|
|
130
|
-
this.paletteEl.setAttribute("global-shortcut", "");
|
|
131
|
-
} else {
|
|
132
|
-
this.paletteEl.removeAttribute("global-shortcut");
|
|
133
|
-
}
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (
|
|
137
|
-
name === "context" ||
|
|
138
|
-
name === "app-url" ||
|
|
139
|
-
name === "marketing-url" ||
|
|
140
|
-
name === "backend-url"
|
|
141
|
-
) {
|
|
142
|
-
void this.loadItems(true);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** Opens the unified command palette. */
|
|
147
|
-
openPalette(): void {
|
|
148
|
-
this.ensurePalette();
|
|
149
|
-
void this.loadItems().then(() => this.paletteEl?.openPalette());
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/** Closes the unified command palette. */
|
|
153
|
-
closePalette(): void {
|
|
154
|
-
this.paletteEl?.closePalette();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
private ensurePalette(): void {
|
|
158
|
-
if (this.paletteEl) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
this.paletteEl = document.createElement(
|
|
163
|
-
"viking-command-palette",
|
|
164
|
-
) as VikingSearchPaletteWc;
|
|
165
|
-
this.paletteEl.id = "deml-command-palette";
|
|
166
|
-
|
|
167
|
-
const placeholder =
|
|
168
|
-
this.getAttribute("placeholder") ??
|
|
169
|
-
"Search documentation, dashboard, settings…";
|
|
170
|
-
this.paletteEl.setAttribute("placeholder", placeholder);
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
readBoolAttr(this, "global-shortcut") ||
|
|
174
|
-
!this.hasAttribute("global-shortcut")
|
|
175
|
-
) {
|
|
176
|
-
this.paletteEl.setAttribute("global-shortcut", "");
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
this.append(this.paletteEl);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
private async loadItems(force = false): Promise<void> {
|
|
183
|
-
if (!this.paletteEl || (this.itemsLoaded && !force)) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const context = readContext(this);
|
|
188
|
-
const urls = readUrls(this);
|
|
189
|
-
let items: VikingSearchPaletteItem[] = buildSuiteSearchItems(
|
|
190
|
-
context,
|
|
191
|
-
urls,
|
|
192
|
-
{
|
|
193
|
-
docsOrigin: window.location.origin,
|
|
194
|
-
},
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
try {
|
|
198
|
-
const response = await fetch("/assets/site-drakkar.json", {
|
|
199
|
-
cache: "no-cache",
|
|
200
|
-
});
|
|
201
|
-
if (response.ok) {
|
|
202
|
-
const drakkar = (await response.json()) as {
|
|
203
|
-
navLinks?: unknown[];
|
|
204
|
-
footerColumns?: unknown[];
|
|
205
|
-
};
|
|
206
|
-
if (drakkar.navLinks?.length || drakkar.footerColumns?.length) {
|
|
207
|
-
items = buildSuiteSearchItems(context, urls, {
|
|
208
|
-
docsOrigin: window.location.origin,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
} catch {
|
|
213
|
-
// Bundled config is authoritative when JSON is unavailable.
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
this.paletteEl.setAttribute("items", JSON.stringify(items));
|
|
217
|
-
this.itemsLoaded = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export const registerVikingSuiteSearchPaletteWc = (): void => {
|
|
222
|
-
defineCustomElement(
|
|
223
|
-
VikingSuiteSearchPaletteWc.tag,
|
|
224
|
-
VikingSuiteSearchPaletteWc,
|
|
225
|
-
);
|
|
226
|
-
defineCustomElementAlias(
|
|
227
|
-
VikingSuiteSearchPaletteWc.searchTag,
|
|
228
|
-
VikingSuiteSearchPaletteWc,
|
|
229
|
-
);
|
|
230
|
-
defineCustomElementAlias(
|
|
231
|
-
VikingSuiteSearchPaletteWc.legacyTag,
|
|
232
|
-
VikingSuiteSearchPaletteWc,
|
|
233
|
-
);
|
|
234
|
-
};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { attachShadowStyles } from "../core/base";
|
|
2
|
-
import { defineCustomElement, HTMLElementBase } from "../core/dom";
|
|
3
|
-
|
|
4
|
-
const VIKING_THEME_TOGGLE_STYLES = `
|
|
5
|
-
:host {
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.theme-toggle-btn {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
flex-shrink: 0;
|
|
14
|
-
width: var(--viking-control-height, 40px);
|
|
15
|
-
height: var(--viking-control-height, 40px);
|
|
16
|
-
min-width: var(--viking-control-height, 40px);
|
|
17
|
-
padding: 0;
|
|
18
|
-
border: 1px solid color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 32%, var(--viking-border-strong, var(--viking-border)));
|
|
19
|
-
border-radius: var(--viking-radius);
|
|
20
|
-
background: color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 8%, var(--viking-surface));
|
|
21
|
-
color: var(--viking-accent-strong, var(--viking-ring));
|
|
22
|
-
box-shadow: var(--viking-shadow-sm);
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
transition: var(--viking-transition-interactive);
|
|
25
|
-
-webkit-tap-highlight-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.theme-toggle-btn:hover {
|
|
29
|
-
border-color: var(--viking-accent-strong, var(--viking-ring));
|
|
30
|
-
background: color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 14%, var(--viking-surface-alt));
|
|
31
|
-
color: var(--viking-accent-strong, var(--viking-ring));
|
|
32
|
-
box-shadow: var(--viking-shadow-md);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.theme-toggle-btn:focus-visible {
|
|
36
|
-
outline: var(--viking-ring-width, 2px) solid var(--viking-ring);
|
|
37
|
-
outline-offset: var(--viking-ring-offset, 2px);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.theme-toggle-btn:active {
|
|
41
|
-
transform: scale(var(--viking-state-active-scale, 0.98));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.theme-icon {
|
|
45
|
-
display: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.theme-icon.is-visible {
|
|
49
|
-
display: block;
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
const applyTheme = (theme: "light" | "dark"): void => {
|
|
54
|
-
document.documentElement.setAttribute("data-theme", theme);
|
|
55
|
-
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
56
|
-
localStorage.setItem("theme", theme);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const readTheme = (): "light" | "dark" => {
|
|
60
|
-
const saved = localStorage.getItem("theme");
|
|
61
|
-
if (saved === "light" || saved === "dark") return saved;
|
|
62
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
63
|
-
? "dark"
|
|
64
|
-
: "light";
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Framework-agnostic theme toggle Web Component.
|
|
69
|
-
* Tag: `viking-theme-toggle-wc`
|
|
70
|
-
*/
|
|
71
|
-
export class VikingThemeToggleWc extends HTMLElementBase {
|
|
72
|
-
static readonly tag = "viking-theme-toggle-wc";
|
|
73
|
-
|
|
74
|
-
private readonly shadow: ShadowRoot;
|
|
75
|
-
private button: HTMLButtonElement | null = null;
|
|
76
|
-
private sunIcon: SVGElement | null = null;
|
|
77
|
-
private moonIcon: SVGElement | null = null;
|
|
78
|
-
|
|
79
|
-
constructor() {
|
|
80
|
-
super();
|
|
81
|
-
this.shadow = this.attachShadow({ mode: "open" });
|
|
82
|
-
attachShadowStyles(this.shadow, VIKING_THEME_TOGGLE_STYLES);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
connectedCallback(): void {
|
|
86
|
-
if (!this.hasAttribute("role")) {
|
|
87
|
-
this.setAttribute("role", "button");
|
|
88
|
-
}
|
|
89
|
-
this.render();
|
|
90
|
-
this.syncIcons();
|
|
91
|
-
this.button?.addEventListener("click", this.onClick);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
disconnectedCallback(): void {
|
|
95
|
-
this.button?.removeEventListener("click", this.onClick);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private readonly onClick = (): void => {
|
|
99
|
-
const next = readTheme() === "light" ? "dark" : "light";
|
|
100
|
-
applyTheme(next);
|
|
101
|
-
this.syncIcons();
|
|
102
|
-
this.dispatchEvent(
|
|
103
|
-
new CustomEvent("viking-theme-change", {
|
|
104
|
-
bubbles: true,
|
|
105
|
-
composed: true,
|
|
106
|
-
detail: { theme: next },
|
|
107
|
-
}),
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
private syncIcons = (): void => {
|
|
112
|
-
const isLight = readTheme() === "light";
|
|
113
|
-
this.sunIcon?.classList.toggle("is-visible", isLight);
|
|
114
|
-
this.moonIcon?.classList.toggle("is-visible", !isLight);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
private render(): void {
|
|
118
|
-
const label =
|
|
119
|
-
this.getAttribute("aria-label") ?? "Toggle light and dark theme";
|
|
120
|
-
this.shadow.innerHTML = `
|
|
121
|
-
<button type="button" class="theme-toggle-btn" part="control" aria-label="${label}">
|
|
122
|
-
<svg class="theme-icon theme-icon-sun" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true">
|
|
123
|
-
<circle cx="12" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="2"/>
|
|
124
|
-
<path stroke="currentColor" stroke-width="2" d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/>
|
|
125
|
-
</svg>
|
|
126
|
-
<svg class="theme-icon theme-icon-moon" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true">
|
|
127
|
-
<path fill="currentColor" d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/>
|
|
128
|
-
</svg>
|
|
129
|
-
</button>
|
|
130
|
-
`;
|
|
131
|
-
this.button = this.shadow.querySelector("button");
|
|
132
|
-
this.sunIcon = this.shadow.querySelector(".theme-icon-sun");
|
|
133
|
-
this.moonIcon = this.shadow.querySelector(".theme-icon-moon");
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export const registerVikingThemeToggleWc = (): void => {
|
|
138
|
-
defineCustomElement(VikingThemeToggleWc.tag, VikingThemeToggleWc);
|
|
139
|
-
};
|
package/src/web/types.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { VikingSearchPaletteItem } from "./core/types";
|
|
2
|
-
|
|
3
|
-
/** Custom events dispatched by Viking-UI Web Components. */
|
|
4
|
-
export type VikingWcChangeDetail = { value: string };
|
|
5
|
-
export type VikingWcQueryDetail = { query: string };
|
|
6
|
-
export type VikingWcSelectDetail = { item: VikingSearchPaletteItem };
|
|
7
|
-
|
|
8
|
-
declare global {
|
|
9
|
-
interface HTMLElementTagNameMap {
|
|
10
|
-
"viking-badge": import("./badge/viking-badge-wc").VikingBadgeWc;
|
|
11
|
-
"viking-badge-wc": import("./badge/viking-badge-wc").VikingBadgeWc;
|
|
12
|
-
"viking-button": import("./button/viking-button-wc").VikingButtonWc;
|
|
13
|
-
"viking-button-wc": import("./button/viking-button-wc").VikingButtonWc;
|
|
14
|
-
"viking-callout": import("./callout/viking-callout-wc").VikingCalloutWc;
|
|
15
|
-
"viking-callout-wc": import("./callout/viking-callout-wc").VikingCalloutWc;
|
|
16
|
-
"viking-card": import("./card/viking-card-wc").VikingCardWc;
|
|
17
|
-
"viking-card-wc": import("./card/viking-card-wc").VikingCardWc;
|
|
18
|
-
"viking-field": import("./field/viking-field-wc").VikingFieldWc;
|
|
19
|
-
"viking-field-wc": import("./field/viking-field-wc").VikingFieldWc;
|
|
20
|
-
"viking-input": import("./input/viking-input-wc").VikingInputWc;
|
|
21
|
-
"viking-input-wc": import("./input/viking-input-wc").VikingInputWc;
|
|
22
|
-
"viking-dialog": import("./modal/viking-modal-wc").VikingModalWc;
|
|
23
|
-
"viking-modal": import("./modal/viking-modal-wc").VikingModalWc;
|
|
24
|
-
"viking-modal-wc": import("./modal/viking-modal-wc").VikingModalWc;
|
|
25
|
-
"viking-command-palette": import("./search-palette/viking-search-palette-wc").VikingSearchPaletteWc;
|
|
26
|
-
"viking-search-palette": import("./search-palette/viking-search-palette-wc").VikingSearchPaletteWc;
|
|
27
|
-
"viking-search-palette-wc": import("./search-palette/viking-search-palette-wc").VikingSearchPaletteWc;
|
|
28
|
-
"viking-select": import("./select/viking-select-wc").VikingSelectWc;
|
|
29
|
-
"viking-select-wc": import("./select/viking-select-wc").VikingSelectWc;
|
|
30
|
-
"viking-suite-command-palette": import("./suite-search-palette/viking-suite-search-palette-wc").VikingSuiteSearchPaletteWc;
|
|
31
|
-
"viking-suite-search-palette": import("./suite-search-palette/viking-suite-search-palette-wc").VikingSuiteSearchPaletteWc;
|
|
32
|
-
"viking-suite-search-palette-wc": import("./suite-search-palette/viking-suite-search-palette-wc").VikingSuiteSearchPaletteWc;
|
|
33
|
-
"viking-theme-toggle-wc": import("./theme-toggle/viking-theme-toggle-wc").VikingThemeToggleWc;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export {};
|