@odx/foundation 1.0.0-beta.241 → 1.0.0-beta.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/breakpoints/main.d.ts +24 -19
- package/dist/breakpoints/types.d.ts +14 -0
- package/dist/breakpoints/utils.d.ts +4 -2
- package/dist/breakpoints.js +14 -11
- package/dist/i18n/main.d.ts +12 -0
- package/dist/i18n/types.d.ts +1 -17
- package/dist/lib/dialog-element.d.ts +0 -5
- package/dist/utils/types.d.ts +3 -0
- package/package.json +1 -1
- package/dist/breakpoints/models.d.ts +0 -15
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
import { BreakpointConfig } from './
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { BreakpointConfig } from './types.js';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace ODX.Breakpoints {
|
|
4
|
+
interface Config {
|
|
5
|
+
mobile: true;
|
|
6
|
+
tablet: true;
|
|
7
|
+
desktop: true;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultBreakpoints: [{
|
|
12
|
+
readonly name: "mobile";
|
|
13
|
+
readonly min: 0;
|
|
14
|
+
readonly max: 575.98;
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "tablet";
|
|
17
|
+
readonly min: 576;
|
|
18
|
+
readonly max: 991.98;
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "desktop";
|
|
21
|
+
readonly min: 992;
|
|
22
|
+
readonly max: 1199.98;
|
|
23
|
+
}];
|
|
19
24
|
export default function setupBreakpoints(breakpointsConfig?: BreakpointConfig[]): () => void;
|
|
20
|
-
export type * from './
|
|
25
|
+
export type * from './types.js';
|
|
21
26
|
export * from './utils.js';
|
|
22
27
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FilteredKeys } from '../utils/main.js';
|
|
2
|
+
export type BreakpointOperator = '<' | '<=' | '>=' | '>';
|
|
3
|
+
export interface BreakpointConfig {
|
|
4
|
+
name: keyof FilteredKeys<ODX.Breakpoints.Config>;
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
customQuery?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Breakpoint extends BreakpointConfig {
|
|
10
|
+
id: BreakpointConfig['name'] | `${BreakpointOperator}${BreakpointConfig['name']}`;
|
|
11
|
+
query: string;
|
|
12
|
+
operator?: BreakpointOperator;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Signal } from '../signals/main.js';
|
|
2
|
-
import { Breakpoint,
|
|
2
|
+
import { Breakpoint, BreakpointConfig, BreakpointOperator } from './types.js';
|
|
3
3
|
export declare const breakpointDirective: import('../utils/main.js').StringAttributeDirective<"odx-breakpoint">;
|
|
4
4
|
export declare const breakpointClassDirective: import('../utils/main.js').StringAttributeDirective<"odx-breakpoint-class">;
|
|
5
5
|
export declare function buildBreakpoint(breakpoint: BreakpointConfig, operator?: BreakpointOperator): Breakpoint;
|
|
@@ -7,5 +7,7 @@ export declare function expandBreakpoints(...breakpoints: BreakpointConfig[]): B
|
|
|
7
7
|
export declare function observeBreakpoint(breakpoint: Breakpoint, initialValue?: boolean): Signal<Breakpoint & {
|
|
8
8
|
matches: boolean;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function createBreakpointDirectiveUpdater(breakpoints: Breakpoint[], update?: (target: HTMLElement, change:
|
|
10
|
+
export declare function createBreakpointDirectiveUpdater(breakpoints: Breakpoint[], update?: (target: HTMLElement, change: Breakpoint & {
|
|
11
|
+
matches: boolean;
|
|
12
|
+
}) => void): () => void;
|
|
11
13
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/breakpoints.js
CHANGED
|
@@ -5,7 +5,7 @@ const operators = ["<", "<=", ">=", ">"];
|
|
|
5
5
|
const breakpointDirective = stringAttributeDirective("odx-breakpoint");
|
|
6
6
|
const breakpointClassDirective = stringAttributeDirective("odx-breakpoint-class");
|
|
7
7
|
function buildBreakpoint(breakpoint, operator) {
|
|
8
|
-
const id = operator ? `${operator}${breakpoint.
|
|
8
|
+
const id = operator ? `${operator}${breakpoint.name}` : breakpoint.name;
|
|
9
9
|
let query = `(min-width: ${breakpoint.min}px) and (max-width: ${breakpoint.max}px)`;
|
|
10
10
|
switch (operator) {
|
|
11
11
|
case "<":
|
|
@@ -58,10 +58,13 @@ function createBreakpointDirectiveUpdater(breakpoints, update) {
|
|
|
58
58
|
const breakpointObservers = breakpoints.map((breakpoint) => observeBreakpoint(breakpoint, false));
|
|
59
59
|
return () => {
|
|
60
60
|
const directives = document.querySelectorAll(breakpointDirective.selector);
|
|
61
|
-
const changes = breakpointObservers.reduce(
|
|
62
|
-
breakpoints2
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const changes = breakpointObservers.reduce(
|
|
62
|
+
(breakpoints2, { value }) => {
|
|
63
|
+
breakpoints2[value.id] = value;
|
|
64
|
+
return breakpoints2;
|
|
65
|
+
},
|
|
66
|
+
{}
|
|
67
|
+
);
|
|
65
68
|
let i = directives.length;
|
|
66
69
|
while (i--) {
|
|
67
70
|
const directive = directives[i];
|
|
@@ -74,13 +77,13 @@ function createBreakpointDirectiveUpdater(breakpoints, update) {
|
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
const defaultBreakpoints =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const defaultBreakpoints = [
|
|
81
|
+
{ name: "mobile", min: 0, max: 575.98 },
|
|
82
|
+
{ name: "tablet", min: 576, max: 991.98 },
|
|
83
|
+
{ name: "desktop", min: 992, max: 1199.98 }
|
|
84
|
+
];
|
|
82
85
|
function setupBreakpoints(breakpointsConfig = []) {
|
|
83
|
-
const breakpoints = expandBreakpoints(...
|
|
86
|
+
const breakpoints = expandBreakpoints(...defaultBreakpoints, ...breakpointsConfig);
|
|
84
87
|
const directiveUpdater = createBreakpointDirectiveUpdater(breakpoints);
|
|
85
88
|
let mutationObserver;
|
|
86
89
|
let unobserveBreakpoints = () => {
|
package/dist/i18n/main.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { ExpandUnion, Loose } from '../utils/main.js';
|
|
2
|
+
import { default as en } from './translations/en.json';
|
|
3
|
+
import { GetTranslationKeysObject } from './types.js';
|
|
1
4
|
export * from './config.js';
|
|
2
5
|
export * from './format.js';
|
|
3
6
|
export * from './is-localized.js';
|
|
@@ -5,4 +8,13 @@ export * from './localization.js';
|
|
|
5
8
|
export * from './models.js';
|
|
6
9
|
export * from './translate.js';
|
|
7
10
|
export type * from './types.js';
|
|
11
|
+
declare global {
|
|
12
|
+
namespace ODX.I18n {
|
|
13
|
+
interface AvailableLanguages {
|
|
14
|
+
en: true;
|
|
15
|
+
}
|
|
16
|
+
type TranslateKey = Loose<ExpandUnion<keyof GetTranslationKeysObject<typeof en>>>;
|
|
17
|
+
type Languages = keyof AvailableLanguages;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
8
20
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/i18n/types.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { default as en } from './translations/en.json';
|
|
3
|
-
type ExtractTranslationKeys<T, Prefix extends string = ''> = {
|
|
1
|
+
export type ExtractTranslationKeys<T, Prefix extends string = ''> = {
|
|
4
2
|
[K in keyof T]: T[K] extends string ? `${Prefix}${K & string}` : T[K] extends object ? ExtractTranslationKeys<T[K], `${Prefix}${K & string}.`> : never;
|
|
5
3
|
}[keyof T];
|
|
6
4
|
export type TranslationSimple = {
|
|
@@ -13,18 +11,4 @@ export type TranslateContext = Record<string, string | number | boolean> | strin
|
|
|
13
11
|
export type GetTranslationKeysObject<T extends TranslationNested> = {
|
|
14
12
|
[key in ExtractTranslationKeys<T>]: true;
|
|
15
13
|
};
|
|
16
|
-
declare global {
|
|
17
|
-
namespace ODX.I18n.Config {
|
|
18
|
-
interface AvailableLanguages {
|
|
19
|
-
en: true;
|
|
20
|
-
}
|
|
21
|
-
interface TranslationKeys extends GetTranslationKeysObject<typeof en> {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
namespace ODX.I18n {
|
|
25
|
-
type TranslateKey = Loose<ExpandUnion<keyof Config.TranslationKeys>>;
|
|
26
|
-
type Languages = keyof Config.AvailableLanguages;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
30
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -148,11 +148,6 @@ export declare const DialogAfterCloseEvent: {
|
|
|
148
148
|
dispatch(target: HTMLElement, eventInit?: CustomEventInit<never> | undefined): boolean;
|
|
149
149
|
};
|
|
150
150
|
export declare const DialogCloseCommand: import('../utils/main.js').CommandDirective<"odx-dialog-close">;
|
|
151
|
-
declare global {
|
|
152
|
-
interface HTMLElementEventMap {
|
|
153
|
-
toggle: ToggleEvent;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
151
|
declare const DialogElement_base: import('../utils/main.js').Constructor<CanBeDisabled> & typeof CustomElement;
|
|
157
152
|
export declare class DialogElement extends DialogElement_base {
|
|
158
153
|
#private;
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ export declare type Constructor<T> = new (...args: any[]) => T;
|
|
|
2
2
|
export type Loose<T extends string> = T | (string & {});
|
|
3
3
|
export type ExpandUnion<T> = T extends unknown ? T : never;
|
|
4
4
|
export type ValuesOf<T extends object> = T[keyof T];
|
|
5
|
+
export type FilteredKeys<T extends object> = {
|
|
6
|
+
[K in keyof T as T[K] extends true ? K : never]: T[K];
|
|
7
|
+
};
|
|
5
8
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@odx/foundation",
|
|
3
3
|
"displayName": "ODX Design System Foundation",
|
|
4
4
|
"description": "A library of Web Component building blocks for ODX",
|
|
5
|
-
"version": "1.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.242",
|
|
6
6
|
"author": "Drägerwerk AG & Co.KGaA",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"homepage": "https://odx.draeger.com",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface BreakpointConfig {
|
|
2
|
-
id: string;
|
|
3
|
-
min: number;
|
|
4
|
-
max: number;
|
|
5
|
-
customQuery?: string;
|
|
6
|
-
}
|
|
7
|
-
export type BreakpointOperator = '<' | '<=' | '>=' | '>';
|
|
8
|
-
export type Breakpoint = BreakpointConfig & {
|
|
9
|
-
query: string;
|
|
10
|
-
operator?: BreakpointOperator;
|
|
11
|
-
};
|
|
12
|
-
export type BreakpointChange = Breakpoint & {
|
|
13
|
-
matches: boolean;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=models.d.ts.map
|