@filip.mazev/blocks 1.4.9 → 1.4.11
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 +15 -3
- package/core/styles/_index.scss +8 -0
- package/core/styles/_overlay.scss +4 -0
- package/core/styles/_palettes.scss +56 -0
- package/core/styles/_theme-engine.scss +180 -149
- package/core/styles/themes/_azure-coral-theme.scss +4 -0
- package/core/styles/themes/_blue-theme.scss +5 -0
- package/core/styles/themes/_cyberpunk-theme.scss +3 -2
- package/core/styles/themes/_graphite-sky-blue-theme.scss +19 -0
- package/core/styles/themes/_green-theme.scss +4 -3
- package/core/styles/themes/_high-contrast-theme.scss +25 -6
- package/core/styles/themes/_lime-violet-theme.scss +4 -0
- package/core/styles/themes/_orange-theme.scss +4 -3
- package/core/styles/themes/_purple-theme.scss +4 -3
- package/core/styles/themes/_red-theme.scss +4 -3
- package/core/styles/themes/_scarlet-cyan-theme.scss +4 -0
- package/core/styles/themes/_tangerine-indigo-theme.scss +4 -0
- package/core/styles/themes/_violet-teal-theme.scss +4 -0
- package/core/styles/themes/_white-theme.scss +4 -27
- package/fesm2022/filip.mazev-blocks-core.mjs +142 -32
- package/fesm2022/filip.mazev-blocks-core.mjs.map +1 -1
- package/fesm2022/filip.mazev-blocks-effects-runtime.mjs +1 -1
- package/fesm2022/filip.mazev-blocks-effects-runtime.mjs.map +1 -1
- package/fesm2022/filip.mazev-blocks-forms.mjs +25 -39
- package/fesm2022/filip.mazev-blocks-forms.mjs.map +1 -1
- package/fesm2022/filip.mazev-blocks-primitives.mjs +1246 -650
- package/fesm2022/filip.mazev-blocks-primitives.mjs.map +1 -1
- package/fesm2022/filip.mazev-blocks.mjs +1 -1
- package/fesm2022/filip.mazev-blocks.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.d.ts +10 -1
- package/schematics/ng-add/index.js +15 -4
- package/schematics/ng-add/schema.json +26 -15
- package/types/filip.mazev-blocks-core.d.ts +20 -7
- package/types/filip.mazev-blocks-forms.d.ts +2 -3
- package/types/filip.mazev-blocks-primitives.d.ts +142 -9
- package/types/filip.mazev-blocks.d.ts +1 -1
|
@@ -12,12 +12,22 @@ $high-contrast-light-theme: validate-theme(
|
|
|
12
12
|
'bg-neutral': $hc-white,
|
|
13
13
|
'bg-neutral-hover': get-color-from-palette('neutral', 50),
|
|
14
14
|
'bg-neutral-active': get-color-from-palette('neutral', 100),
|
|
15
|
-
|
|
16
15
|
'primary': $hc-black,
|
|
17
16
|
'primary-hover': $hc-black,
|
|
18
17
|
'primary-active': $hc-black,
|
|
19
18
|
'primary-subtle': $hc-white,
|
|
20
19
|
'on-primary': $hc-white,
|
|
20
|
+
'on-primary-hover': $hc-white,
|
|
21
|
+
'on-primary-active': $hc-white,
|
|
22
|
+
'accent': $hc-black,
|
|
23
|
+
'accent-hover': $hc-black,
|
|
24
|
+
'accent-active': $hc-black,
|
|
25
|
+
'accent-subtle': $hc-white,
|
|
26
|
+
'on-accent': $hc-white,
|
|
27
|
+
'on-accent-hover': $hc-white,
|
|
28
|
+
'on-accent-active': $hc-white,
|
|
29
|
+
'text-accent': $hc-black,
|
|
30
|
+
'border-accent': $hc-black,
|
|
21
31
|
|
|
22
32
|
'text-heading': $hc-black,
|
|
23
33
|
'text-primary': $hc-black,
|
|
@@ -28,7 +38,6 @@ $high-contrast-light-theme: validate-theme(
|
|
|
28
38
|
'text-success': get-color-from-palette('success', 800),
|
|
29
39
|
'text-warn': get-color-from-palette('warn', 800),
|
|
30
40
|
'text-danger': get-color-from-palette('danger', 700),
|
|
31
|
-
|
|
32
41
|
'border-subtle': $hc-black,
|
|
33
42
|
'border-default': $hc-black,
|
|
34
43
|
'border-strong': $hc-black,
|
|
@@ -65,8 +74,8 @@ $high-contrast-light-theme: validate-theme(
|
|
|
65
74
|
'scroll-bg': $hc-white,
|
|
66
75
|
'scroll-thumb': $hc-black,
|
|
67
76
|
'scroll-thumb-hover': get-color-from-palette('neutral', 700),
|
|
68
|
-
|
|
69
77
|
'meta-brand-palette': 'neutral',
|
|
78
|
+
'meta-accent-palette': 'neutral',
|
|
70
79
|
),
|
|
71
80
|
'high-contrast-light'
|
|
72
81
|
) !default;
|
|
@@ -81,12 +90,22 @@ $high-contrast-dark-theme: validate-theme(
|
|
|
81
90
|
'bg-neutral': $hc-black,
|
|
82
91
|
'bg-neutral-hover': get-color-from-palette('neutral', 1000),
|
|
83
92
|
'bg-neutral-active': get-color-from-palette('neutral', 1000),
|
|
84
|
-
|
|
85
93
|
'primary': $hc-white,
|
|
86
94
|
'primary-hover': $hc-white,
|
|
87
95
|
'primary-active': $hc-white,
|
|
88
96
|
'primary-subtle': $hc-black,
|
|
89
97
|
'on-primary': $hc-black,
|
|
98
|
+
'on-primary-hover': $hc-black,
|
|
99
|
+
'on-primary-active': $hc-black,
|
|
100
|
+
'accent': $hc-white,
|
|
101
|
+
'accent-hover': $hc-white,
|
|
102
|
+
'accent-active': $hc-white,
|
|
103
|
+
'accent-subtle': $hc-black,
|
|
104
|
+
'on-accent': $hc-black,
|
|
105
|
+
'on-accent-hover': $hc-black,
|
|
106
|
+
'on-accent-active': $hc-black,
|
|
107
|
+
'text-accent': $hc-white,
|
|
108
|
+
'border-accent': $hc-white,
|
|
90
109
|
|
|
91
110
|
'text-heading': $hc-white,
|
|
92
111
|
'text-primary': $hc-white,
|
|
@@ -134,13 +153,12 @@ $high-contrast-dark-theme: validate-theme(
|
|
|
134
153
|
'scroll-bg': $hc-black,
|
|
135
154
|
'scroll-thumb': $hc-white,
|
|
136
155
|
'scroll-thumb-hover': get-color-from-palette('neutral', 300),
|
|
137
|
-
|
|
138
156
|
'meta-brand-palette': 'neutral',
|
|
157
|
+
'meta-accent-palette': 'neutral',
|
|
139
158
|
),
|
|
140
159
|
'high-contrast-dark'
|
|
141
160
|
) !default;
|
|
142
161
|
|
|
143
|
-
// The Blocks high-contrast palette is an explicit accessibility choice, independent of OS media queries.
|
|
144
162
|
:where(.high-contrast, .bx-high-contrast-scope) {
|
|
145
163
|
[data-bx-surface] {
|
|
146
164
|
color: var(--bx-glass-text, var(--bx-text-primary)) !important;
|
|
@@ -154,6 +172,7 @@ $high-contrast-dark-theme: validate-theme(
|
|
|
154
172
|
[data-bx-surface],
|
|
155
173
|
.bx-glass-material {
|
|
156
174
|
background: var(--bx-glass-surface, var(--bx-bg-surface)) !important;
|
|
175
|
+
/* stylelint-disable-next-line property-no-vendor-prefix -- Required to disable glass in older Safari. */
|
|
157
176
|
-webkit-backdrop-filter: none !important;
|
|
158
177
|
backdrop-filter: none !important;
|
|
159
178
|
box-shadow: none !important;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Compatibility aliases. New applications should use the paired palette name.
|
|
2
|
+
@use 'tangerine-indigo-theme' as paired;
|
|
2
3
|
|
|
3
|
-
$orange-light-theme:
|
|
4
|
-
$orange-dark-theme:
|
|
4
|
+
$orange-light-theme: paired.$tangerine-indigo-light-theme;
|
|
5
|
+
$orange-dark-theme: paired.$tangerine-indigo-dark-theme;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Compatibility aliases. New applications should use the paired palette name.
|
|
2
|
+
@use 'violet-teal-theme' as paired;
|
|
2
3
|
|
|
3
|
-
$purple-light-theme:
|
|
4
|
-
$purple-dark-theme:
|
|
4
|
+
$purple-light-theme: paired.$violet-teal-light-theme;
|
|
5
|
+
$purple-dark-theme: paired.$violet-teal-dark-theme;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Compatibility aliases. New applications should use the paired palette name.
|
|
2
|
+
@use 'scarlet-cyan-theme' as paired;
|
|
2
3
|
|
|
3
|
-
$red-light-theme:
|
|
4
|
-
$red-dark-theme:
|
|
4
|
+
$red-light-theme: paired.$scarlet-cyan-light-theme;
|
|
5
|
+
$red-dark-theme: paired.$scarlet-cyan-dark-theme;
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// Compatibility aliases. New applications should use the paired palette name.
|
|
2
|
+
@use 'graphite-sky-blue-theme' as paired;
|
|
2
3
|
|
|
3
|
-
$white-light-theme:
|
|
4
|
-
|
|
5
|
-
$overrides: (
|
|
6
|
-
'primary': #525252,
|
|
7
|
-
'primary-hover': #404040,
|
|
8
|
-
'primary-active': #262626,
|
|
9
|
-
'primary-subtle': rgba(#737373, 0.12),
|
|
10
|
-
'on-primary': #ffffff,
|
|
11
|
-
'text-brand': #404040,
|
|
12
|
-
'border-brand': #737373,
|
|
13
|
-
)
|
|
14
|
-
);
|
|
15
|
-
$white-dark-theme: make-dark-theme(
|
|
16
|
-
'neutral',
|
|
17
|
-
$overrides: (
|
|
18
|
-
'primary': #ffffff,
|
|
19
|
-
'primary-hover': #e5e5e5,
|
|
20
|
-
'primary-active': #d4d4d4,
|
|
21
|
-
'primary-subtle': rgba(#ffffff, 0.12),
|
|
22
|
-
'on-primary': #171717,
|
|
23
|
-
'text-brand': #f5f5f5,
|
|
24
|
-
'border-brand': #d4d4d4,
|
|
25
|
-
'scroll-thumb': #737373,
|
|
26
|
-
'scroll-thumb-hover': #a3a3a3,
|
|
27
|
-
)
|
|
28
|
-
);
|
|
4
|
+
$white-light-theme: paired.$graphite-sky-blue-light-theme;
|
|
5
|
+
$white-dark-theme: paired.$graphite-sky-blue-dark-theme;
|
|
@@ -5,7 +5,7 @@ import { fromEvent } from "rxjs";
|
|
|
5
5
|
import { debounceTime, distinctUntilChanged, map } from "rxjs/operators";
|
|
6
6
|
import { toObservable } from "@angular/core/rxjs-interop";
|
|
7
7
|
import { configureAppearance } from "@filip.mazev/blocks/effects/runtime";
|
|
8
|
-
import { ConnectionPositionPair, Overlay } from "@angular/cdk/overlay";
|
|
8
|
+
import { ConnectionPositionPair, FlexibleConnectedPositionStrategy, Overlay } from "@angular/cdk/overlay";
|
|
9
9
|
import { NgControl, Validators } from "@angular/forms";
|
|
10
10
|
var DesktopOS;
|
|
11
11
|
(function(DesktopOS) {
|
|
@@ -348,38 +348,63 @@ const DEFAULT_APPEARANCE_CONFIG = Object.freeze({
|
|
|
348
348
|
quality: "auto",
|
|
349
349
|
reducedTransparency: false
|
|
350
350
|
});
|
|
351
|
+
const LEGACY_THEME_IDS = {
|
|
352
|
+
white: "graphite-sky-blue",
|
|
353
|
+
blue: "azure-coral",
|
|
354
|
+
purple: "violet-teal",
|
|
355
|
+
orange: "tangerine-indigo",
|
|
356
|
+
red: "scarlet-cyan",
|
|
357
|
+
green: "lime-violet"
|
|
358
|
+
};
|
|
351
359
|
const THEME_PALETTES = [
|
|
352
360
|
{
|
|
353
|
-
id: "
|
|
354
|
-
label: "
|
|
355
|
-
className: "theme-
|
|
361
|
+
id: "graphite-sky-blue",
|
|
362
|
+
label: "Graphite / Sky Blue",
|
|
363
|
+
className: "theme-graphite-sky-blue",
|
|
364
|
+
colors: ["#525252", "#38bdf8"]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
id: "azure-coral",
|
|
368
|
+
label: "Azure / Coral",
|
|
369
|
+
className: "theme-azure-coral",
|
|
370
|
+
colors: ["#217eff", "#f87763"]
|
|
356
371
|
},
|
|
357
372
|
{
|
|
358
|
-
id: "
|
|
359
|
-
label: "
|
|
360
|
-
className: "theme-
|
|
373
|
+
id: "violet-teal",
|
|
374
|
+
label: "Violet / Teal",
|
|
375
|
+
className: "theme-violet-teal",
|
|
376
|
+
colors: ["#6d00ff", "#0d9488"]
|
|
361
377
|
},
|
|
362
378
|
{
|
|
363
|
-
id: "
|
|
364
|
-
label: "
|
|
365
|
-
className: "theme-
|
|
379
|
+
id: "tangerine-indigo",
|
|
380
|
+
label: "Tangerine / Indigo",
|
|
381
|
+
className: "theme-tangerine-indigo",
|
|
382
|
+
colors: ["#ff6900", "#4f78f5"]
|
|
366
383
|
},
|
|
367
384
|
{
|
|
368
|
-
id: "
|
|
369
|
-
label: "
|
|
370
|
-
className: "theme-
|
|
385
|
+
id: "scarlet-cyan",
|
|
386
|
+
label: "Scarlet / Cyan",
|
|
387
|
+
className: "theme-scarlet-cyan",
|
|
388
|
+
colors: ["#e3241b", "#0891b2"]
|
|
371
389
|
},
|
|
372
390
|
{
|
|
373
|
-
id: "
|
|
374
|
-
label: "
|
|
375
|
-
className: "theme-
|
|
391
|
+
id: "lime-violet",
|
|
392
|
+
label: "Lime / Violet",
|
|
393
|
+
className: "theme-lime-violet",
|
|
394
|
+
colors: ["#c4f53d", "#6842a6"]
|
|
376
395
|
},
|
|
377
396
|
{
|
|
378
397
|
id: "cyberpunk",
|
|
379
398
|
label: "Cyberpunk",
|
|
380
|
-
className: "theme-cyberpunk"
|
|
399
|
+
className: "theme-cyberpunk",
|
|
400
|
+
colors: ["#3e5669", "#e6da00"]
|
|
381
401
|
}
|
|
382
402
|
];
|
|
403
|
+
function resolveThemeId(value) {
|
|
404
|
+
const palette = THEME_PALETTES.find((item) => item.id === value);
|
|
405
|
+
if (palette) return palette.id;
|
|
406
|
+
if (value && Object.prototype.hasOwnProperty.call(LEGACY_THEME_IDS, value)) return LEGACY_THEME_IDS[value];
|
|
407
|
+
}
|
|
383
408
|
var BxA11yService = class BxA11yService {
|
|
384
409
|
document = inject(DOCUMENT$1);
|
|
385
410
|
platformId = inject(PLATFORM_ID);
|
|
@@ -452,7 +477,7 @@ var ThemingService = class ThemingService {
|
|
|
452
477
|
_appearance = signal({ ...DEFAULT_APPEARANCE_CONFIG }, ...ngDevMode ? [{ debugName: "_appearance" }] : /* istanbul ignore next */ []);
|
|
453
478
|
appearance = this._appearance.asReadonly();
|
|
454
479
|
palettes = THEME_PALETTES;
|
|
455
|
-
_palette = signal("
|
|
480
|
+
_palette = signal("graphite-sky-blue", ...ngDevMode ? [{ debugName: "_palette" }] : /* istanbul ignore next */ []);
|
|
456
481
|
palette = this._palette.asReadonly();
|
|
457
482
|
paletteLabel = computed(() => this.palettes.find((item) => item.id === this.palette())?.label ?? this.palettes[0].label, ...ngDevMode ? [{ debugName: "paletteLabel" }] : /* istanbul ignore next */ []);
|
|
458
483
|
_highContrast = signal(false, ...ngDevMode ? [{ debugName: "_highContrast" }] : /* istanbul ignore next */ []);
|
|
@@ -480,7 +505,7 @@ var ThemingService = class ThemingService {
|
|
|
480
505
|
this.restoreAppearance();
|
|
481
506
|
const palette = this.readStored("theme-palette");
|
|
482
507
|
const storedHighContrast = this.readStored("theme-high-contrast");
|
|
483
|
-
this.setPalette(
|
|
508
|
+
this.setPalette(resolveThemeId(palette) ?? "graphite-sky-blue");
|
|
484
509
|
this.setHighContrast(storedHighContrast === null ? palette === "high-contrast" : storedHighContrast === "true");
|
|
485
510
|
this.appearanceController = configureAppearance(this.document.documentElement, {
|
|
486
511
|
...this.appearance(),
|
|
@@ -499,10 +524,12 @@ var ThemingService = class ThemingService {
|
|
|
499
524
|
if (this.isBrowser) this.writeStored("theme", theme);
|
|
500
525
|
}
|
|
501
526
|
setPalette(palette) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
527
|
+
const id = resolveThemeId(palette);
|
|
528
|
+
if (!id) return;
|
|
529
|
+
this._palette.set(id);
|
|
530
|
+
for (const legacy of Object.keys(LEGACY_THEME_IDS)) this.document.documentElement.classList.remove(`theme-${legacy}`);
|
|
531
|
+
for (const item of this.palettes) this.document.documentElement.classList.toggle(item.className, item.id === id);
|
|
532
|
+
if (this.isBrowser) this.writeStored("theme-palette", id);
|
|
506
533
|
}
|
|
507
534
|
setHighContrast(enabled) {
|
|
508
535
|
this._highContrast.set(enabled);
|
|
@@ -970,11 +997,29 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
970
997
|
const DEFAULT_DEBOUNCE_TIME = 300;
|
|
971
998
|
const SCROLL_LOCK_INSTANCE_IDENTIFIER = "scroll_lock_instance_";
|
|
972
999
|
const PALETTE_NAMES = [
|
|
1000
|
+
"primary",
|
|
1001
|
+
"accent",
|
|
1002
|
+
"graphite",
|
|
1003
|
+
"sky-blue",
|
|
1004
|
+
"azure",
|
|
1005
|
+
"coral",
|
|
1006
|
+
"violet",
|
|
1007
|
+
"teal",
|
|
1008
|
+
"tangerine",
|
|
1009
|
+
"indigo",
|
|
1010
|
+
"scarlet",
|
|
1011
|
+
"cyan",
|
|
1012
|
+
"lime",
|
|
1013
|
+
"cool-violet",
|
|
1014
|
+
"cyber-yellow",
|
|
1015
|
+
"cyber-slate",
|
|
1016
|
+
"blue",
|
|
973
1017
|
"orange",
|
|
974
1018
|
"purple",
|
|
975
1019
|
"red",
|
|
976
1020
|
"green",
|
|
977
1021
|
"danger",
|
|
1022
|
+
"warn",
|
|
978
1023
|
"success",
|
|
979
1024
|
"information",
|
|
980
1025
|
"neutral"
|
|
@@ -1008,6 +1053,17 @@ const SEMANTIC_PAIRS = {
|
|
|
1008
1053
|
"text-brand": "bg-surface",
|
|
1009
1054
|
"text-inverse": "primary",
|
|
1010
1055
|
"on-primary": "primary",
|
|
1056
|
+
"on-primary-hover": "primary-hover",
|
|
1057
|
+
"on-primary-active": "primary-active",
|
|
1058
|
+
accent: "accent-subtle",
|
|
1059
|
+
"accent-hover": "on-accent-hover",
|
|
1060
|
+
"accent-active": "on-accent-active",
|
|
1061
|
+
"accent-subtle": "text-accent",
|
|
1062
|
+
"on-accent": "accent",
|
|
1063
|
+
"on-accent-hover": "accent-hover",
|
|
1064
|
+
"on-accent-active": "accent-active",
|
|
1065
|
+
"text-accent": "accent-subtle",
|
|
1066
|
+
"border-accent": "bg-surface",
|
|
1011
1067
|
primary: "primary-subtle",
|
|
1012
1068
|
"primary-hover": "on-primary",
|
|
1013
1069
|
"primary-active": "on-primary",
|
|
@@ -1090,23 +1146,22 @@ function inheritOverlayTheme(source, pane) {
|
|
|
1090
1146
|
const copied = /* @__PURE__ */ new Set();
|
|
1091
1147
|
const refresh = () => {
|
|
1092
1148
|
const styles = win.getComputedStyle(source);
|
|
1149
|
+
const inherited = win.getComputedStyle(pane.parentElement ?? pane);
|
|
1093
1150
|
const current = /* @__PURE__ */ new Set();
|
|
1094
1151
|
for (let index = 0; index < styles.length; index++) {
|
|
1095
1152
|
const property = styles.item(index);
|
|
1096
|
-
if (property.startsWith("--
|
|
1097
|
-
|
|
1098
|
-
|
|
1153
|
+
if (property.startsWith("--")) {
|
|
1154
|
+
const value = styles.getPropertyValue(property);
|
|
1155
|
+
if (value !== inherited.getPropertyValue(property)) {
|
|
1156
|
+
pane.style.setProperty(property, value);
|
|
1157
|
+
current.add(property);
|
|
1158
|
+
}
|
|
1099
1159
|
}
|
|
1100
1160
|
}
|
|
1101
1161
|
for (const property of copied) if (!current.has(property)) pane.style.removeProperty(property);
|
|
1102
1162
|
copied.clear();
|
|
1103
1163
|
current.forEach((property) => copied.add(property));
|
|
1104
|
-
pane.style.setProperty("--bx-glass-surface", "var(--bx-bg-surface)");
|
|
1105
|
-
pane.style.setProperty("--bx-glass-text", "var(--bx-text-primary)");
|
|
1106
|
-
pane.style.setProperty("--bx-glass-edge", "var(--bx-border-subtle)");
|
|
1107
|
-
pane.style.setProperty("--bx-glass-accent", "var(--bx-primary)");
|
|
1108
1164
|
pane.classList.toggle("bx-high-contrast-scope", !!source.closest(".high-contrast, .bx-high-contrast-scope"));
|
|
1109
|
-
pane.style.color = "var(--bx-text-primary)";
|
|
1110
1165
|
pane.style.fontFamily = styles.fontFamily;
|
|
1111
1166
|
pane.style.colorScheme = styles.colorScheme;
|
|
1112
1167
|
};
|
|
@@ -1126,6 +1181,61 @@ function inheritOverlayTheme(source, pane) {
|
|
|
1126
1181
|
});
|
|
1127
1182
|
return () => observer.disconnect();
|
|
1128
1183
|
}
|
|
1129
|
-
|
|
1184
|
+
let nextAnchor = 0;
|
|
1185
|
+
function trackOverlayOrigin(overlay, origin) {
|
|
1186
|
+
const view = origin.ownerDocument.defaultView;
|
|
1187
|
+
const strategy = overlay.getConfig().positionStrategy;
|
|
1188
|
+
if (!view || !(strategy instanceof FlexibleConnectedPositionStrategy)) return () => {};
|
|
1189
|
+
const host = overlay.hostElement;
|
|
1190
|
+
const anchor = view.CSS?.supports("position-anchor", "--bx-origin") && !!(origin.compareDocumentPosition(host) & Node.DOCUMENT_POSITION_FOLLOWING) ? `--bx-overlay-origin-${++nextAnchor}` : null;
|
|
1191
|
+
const originalAnchor = origin.style.getPropertyValue("anchor-name");
|
|
1192
|
+
const originalPriority = origin.style.getPropertyPriority("anchor-name");
|
|
1193
|
+
if (anchor) {
|
|
1194
|
+
const names = view.getComputedStyle(origin).getPropertyValue("anchor-name").trim();
|
|
1195
|
+
origin.style.setProperty("anchor-name", names && names !== "none" ? `${names}, ${anchor}` : anchor);
|
|
1196
|
+
host.style.setProperty("position-anchor", anchor);
|
|
1197
|
+
}
|
|
1198
|
+
const reposition = () => {
|
|
1199
|
+
if (!overlay.hasAttached()) return;
|
|
1200
|
+
if (!anchor) {
|
|
1201
|
+
strategy.reapplyLastPosition();
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
host.classList.remove("bx-overlay-anchored");
|
|
1205
|
+
overlay.updatePosition();
|
|
1206
|
+
const source = origin.getBoundingClientRect();
|
|
1207
|
+
const target = host.getBoundingClientRect();
|
|
1208
|
+
host.style.setProperty("--bx-overlay-anchor-top", `calc(anchor(top) + ${target.top - source.top}px)`);
|
|
1209
|
+
host.style.setProperty("--bx-overlay-anchor-left", `calc(anchor(left) + ${target.left - source.left}px)`);
|
|
1210
|
+
host.classList.add("bx-overlay-anchored");
|
|
1211
|
+
};
|
|
1212
|
+
const onScroll = (event) => {
|
|
1213
|
+
const target = event.target;
|
|
1214
|
+
if (target === view || target instanceof Node && target.contains(origin)) reposition();
|
|
1215
|
+
};
|
|
1216
|
+
if (!anchor) view.addEventListener("scroll", onScroll, {
|
|
1217
|
+
capture: true,
|
|
1218
|
+
passive: true
|
|
1219
|
+
});
|
|
1220
|
+
view.addEventListener("resize", reposition, { passive: true });
|
|
1221
|
+
const resize = new view.ResizeObserver(reposition);
|
|
1222
|
+
resize.observe(origin);
|
|
1223
|
+
resize.observe(overlay.overlayElement);
|
|
1224
|
+
reposition();
|
|
1225
|
+
return () => {
|
|
1226
|
+
resize.disconnect();
|
|
1227
|
+
view.removeEventListener("resize", reposition);
|
|
1228
|
+
if (!anchor) view.removeEventListener("scroll", onScroll, true);
|
|
1229
|
+
else {
|
|
1230
|
+
host.classList.remove("bx-overlay-anchored");
|
|
1231
|
+
host.style.removeProperty("position-anchor");
|
|
1232
|
+
host.style.removeProperty("--bx-overlay-anchor-top");
|
|
1233
|
+
host.style.removeProperty("--bx-overlay-anchor-left");
|
|
1234
|
+
if (originalAnchor) origin.style.setProperty("anchor-name", originalAnchor, originalPriority);
|
|
1235
|
+
else origin.style.removeProperty("anchor-name");
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
export { BREAKPOINTS, BX_I18N, BxA11yService, BxBaseControl, BxOverlayPositionService, BxShortcutService, DEFAULT_APPEARANCE_CONFIG, DEFAULT_DEBOUNCE_TIME, DesktopOS, DeviceTypeService, FALLBACK_COLOR, LEGACY_THEME_IDS, MobileOS, PALETTE_NAMES, SCROLL_LOCK_INSTANCE_IDENTIFIER, SEMANTIC_PAIRS, SHADE_NUMBERS, ScrollLockService, THEME_PALETTES, TOKEN_COLOR_DELIMITER, TOKEN_DELIMITER, TOKEN_PREFIX, ThemingService, WindowDimensionsService, getComplementaryToken, inheritOverlayTheme, invertPaletteToken, isOSShortcut, isPaletteToken, isTextWithKey, isThemedColor, resolveThemeId, resolveTokenToCssVar, trackOverlayOrigin, uuidv4 };
|
|
1130
1240
|
|
|
1131
1241
|
//# sourceMappingURL=filip.mazev-blocks-core.mjs.map
|