@synergy-design-system/components 1.0.0-main.2 → 1.0.0-main.4
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/LICENSE +28 -0
- package/README.md +6 -0
- package/dist/chunks/chunk.2FIY3TX5.js +32 -0
- package/dist/chunks/chunk.2FIY3TX5.js.map +7 -0
- package/dist/chunks/chunk.5OIEI73E.js +45 -0
- package/dist/chunks/chunk.5OIEI73E.js.map +7 -0
- package/dist/chunks/chunk.5PZUAKCS.js +202 -0
- package/dist/chunks/chunk.5PZUAKCS.js.map +7 -0
- package/dist/chunks/chunk.6C4JXZZN.js +15 -0
- package/dist/chunks/chunk.6C4JXZZN.js.map +7 -0
- package/dist/chunks/chunk.7EGSHKGV.js +12 -0
- package/dist/chunks/chunk.7EGSHKGV.js.map +7 -0
- package/dist/chunks/chunk.A3SKDWCT.js +42 -0
- package/dist/chunks/chunk.A3SKDWCT.js.map +7 -0
- package/dist/chunks/chunk.BQPK6UKU.js +498 -0
- package/dist/chunks/chunk.BQPK6UKU.js.map +7 -0
- package/dist/chunks/chunk.BREU4ILT.js +28 -0
- package/dist/chunks/chunk.BREU4ILT.js.map +7 -0
- package/dist/chunks/chunk.C7624ITA.js +30 -0
- package/dist/chunks/chunk.C7624ITA.js.map +7 -0
- package/dist/chunks/chunk.DJOAQ4JU.js +36 -0
- package/dist/chunks/chunk.DJOAQ4JU.js.map +7 -0
- package/dist/chunks/chunk.DREO4ZTN.js +10 -0
- package/dist/chunks/chunk.DREO4ZTN.js.map +7 -0
- package/dist/chunks/chunk.EW2JZPYV.js +12 -0
- package/dist/chunks/chunk.EW2JZPYV.js.map +7 -0
- package/dist/chunks/chunk.FUYWF5Y2.js +278 -0
- package/dist/chunks/chunk.FUYWF5Y2.js.map +7 -0
- package/dist/chunks/chunk.ILONRPL4.js +10 -0
- package/dist/chunks/chunk.ILONRPL4.js.map +7 -0
- package/dist/chunks/chunk.N2I6HVX3.js +71 -0
- package/dist/chunks/chunk.N2I6HVX3.js.map +7 -0
- package/dist/chunks/chunk.O7USYXBT.js +23 -0
- package/dist/chunks/chunk.O7USYXBT.js.map +7 -0
- package/dist/chunks/chunk.P22LQI5J.js +376 -0
- package/dist/chunks/chunk.P22LQI5J.js.map +7 -0
- package/dist/chunks/chunk.Q77OTWF2.js +378 -0
- package/dist/chunks/chunk.Q77OTWF2.js.map +7 -0
- package/dist/chunks/chunk.R6VNLE6N.js +11 -0
- package/dist/chunks/chunk.R6VNLE6N.js.map +7 -0
- package/dist/chunks/chunk.SLLG4KJR.js +63 -0
- package/dist/chunks/chunk.SLLG4KJR.js.map +7 -0
- package/dist/chunks/chunk.U7ZJ22QM.js +128 -0
- package/dist/chunks/chunk.U7ZJ22QM.js.map +7 -0
- package/dist/chunks/chunk.WDCAHRYG.js +273 -0
- package/dist/chunks/chunk.WDCAHRYG.js.map +7 -0
- package/dist/chunks/chunk.WTCUSH7V.js +42 -0
- package/dist/chunks/chunk.WTCUSH7V.js.map +7 -0
- package/dist/chunks/chunk.XGXFE6IF.js +49 -0
- package/dist/chunks/chunk.XGXFE6IF.js.map +7 -0
- package/dist/components/button/button.component.d.ts +123 -0
- package/dist/components/button/button.component.js +24 -0
- package/dist/components/button/button.component.js.map +7 -0
- package/dist/components/button/button.custom.styles.d.ts +2 -0
- package/dist/components/button/button.custom.styles.js +8 -0
- package/dist/components/button/button.custom.styles.js.map +7 -0
- package/dist/components/button/button.d.ts +8 -0
- package/dist/components/button/button.js +25 -0
- package/dist/components/button/button.js.map +7 -0
- package/dist/components/button/button.styles.d.ts +2 -0
- package/dist/components/button/button.styles.js +10 -0
- package/dist/components/button/button.styles.js.map +7 -0
- package/dist/components/checkbox/checkbox.custom.styles.d.ts +2 -0
- package/dist/components/checkbox/checkbox.custom.styles.js +11 -0
- package/dist/components/checkbox/checkbox.custom.styles.js.map +7 -0
- package/dist/components/icon/icon.component.d.ts +42 -0
- package/dist/components/icon/icon.component.js +15 -0
- package/dist/components/icon/icon.component.js.map +7 -0
- package/dist/components/icon/icon.d.ts +8 -0
- package/dist/components/icon/icon.js +19 -0
- package/dist/components/icon/icon.js.map +7 -0
- package/dist/components/icon/icon.styles.d.ts +2 -0
- package/dist/components/icon/icon.styles.js +9 -0
- package/dist/components/icon/icon.styles.js.map +7 -0
- package/dist/components/icon/library.d.ts +19 -0
- package/dist/components/icon/library.default.d.ts +3 -0
- package/dist/components/icon/library.default.js +9 -0
- package/dist/components/icon/library.default.js.map +7 -0
- package/dist/components/icon/library.js +19 -0
- package/dist/components/icon/library.js.map +7 -0
- package/dist/components/icon/library.system.d.ts +3 -0
- package/dist/components/icon/library.system.js +8 -0
- package/dist/components/icon/library.system.js.map +7 -0
- package/dist/components/input/input.component.d.ts +175 -0
- package/dist/components/input/input.component.js +22 -0
- package/dist/components/input/input.component.js.map +7 -0
- package/dist/components/input/input.custom.styles.d.ts +2 -0
- package/dist/components/input/input.custom.styles.js +8 -0
- package/dist/components/input/input.custom.styles.js.map +7 -0
- package/dist/components/input/input.d.ts +8 -0
- package/dist/components/input/input.js +23 -0
- package/dist/components/input/input.js.map +7 -0
- package/dist/components/input/input.styles.d.ts +2 -0
- package/dist/components/input/input.styles.js +10 -0
- package/dist/components/input/input.styles.js.map +7 -0
- package/dist/components/spinner/spinner.component.d.ts +20 -0
- package/dist/components/spinner/spinner.component.js +13 -0
- package/dist/components/spinner/spinner.component.js.map +7 -0
- package/dist/components/spinner/spinner.styles.d.ts +2 -0
- package/dist/components/spinner/spinner.styles.js +9 -0
- package/dist/components/spinner/spinner.styles.js.map +7 -0
- package/dist/components/textarea/textarea.custom.styles.d.ts +2 -0
- package/dist/components/textarea/textarea.custom.styles.js +11 -0
- package/dist/components/textarea/textarea.custom.styles.js.map +7 -0
- package/dist/custom-elements.json +1870 -0
- package/dist/events/events.d.ts +8 -0
- package/dist/events/syn-blur.d.ts +6 -0
- package/dist/events/syn-change.d.ts +6 -0
- package/dist/events/syn-clear.d.ts +6 -0
- package/dist/events/syn-error.d.ts +8 -0
- package/dist/events/syn-focus.d.ts +6 -0
- package/dist/events/syn-input.d.ts +6 -0
- package/dist/events/syn-invalid.d.ts +6 -0
- package/dist/events/syn-load.d.ts +6 -0
- package/dist/internal/default-value.d.ts +2 -0
- package/dist/internal/form.d.ts +73 -0
- package/dist/internal/slot.d.ts +23 -0
- package/dist/internal/synergy-element.d.ts +47 -0
- package/dist/internal/test/form-control-base-tests.d.ts +7 -0
- package/dist/internal/watch.d.ts +26 -0
- package/dist/styles/component.styles.d.ts +2 -0
- package/dist/styles/form-control.styles.d.ts +2 -0
- package/dist/synergy-autoloader.d.ts +4 -0
- package/dist/synergy-autoloader.js +41 -0
- package/dist/synergy-autoloader.js.map +7 -0
- package/dist/synergy.d.ts +4 -0
- package/dist/synergy.js +38 -0
- package/dist/synergy.js.map +7 -0
- package/dist/translations/de.d.ts +3 -0
- package/dist/translations/de.js +46 -0
- package/dist/translations/de.js.map +7 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +8 -0
- package/dist/translations/en.js.map +7 -0
- package/dist/utilities/base-path.d.ts +18 -0
- package/dist/utilities/base-path.js +10 -0
- package/dist/utilities/base-path.js.map +7 -0
- package/dist/utilities/form.d.ts +11 -0
- package/dist/utilities/form.js +11 -0
- package/dist/utilities/form.js.map +7 -0
- package/dist/utilities/localize.d.ts +33 -0
- package/dist/utilities/localize.js +11 -0
- package/dist/utilities/localize.js.map +7 -0
- package/dist/vscode.html-custom-data.json +371 -0
- package/dist/web-types.json +738 -0
- package/package.json +39 -25
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * from './syn-blur.ts';
|
|
2
|
+
export type * from './syn-change.ts';
|
|
3
|
+
export type * from './syn-clear.ts';
|
|
4
|
+
export type * from './syn-error.ts';
|
|
5
|
+
export type * from './syn-focus.ts';
|
|
6
|
+
export type * from './syn-input.ts';
|
|
7
|
+
export type * from './syn-invalid.ts';
|
|
8
|
+
export type * from './syn-load.ts';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
import type { SynergyFormControl } from '../internal/synergy-element.js';
|
|
3
|
+
import type SynButton from '../components/button/button.js';
|
|
4
|
+
export declare const formCollections: WeakMap<HTMLFormElement, Set<SynergyFormControl>>;
|
|
5
|
+
export interface FormControlControllerOptions {
|
|
6
|
+
/** A function that returns the form containing the form control. */
|
|
7
|
+
form: (input: SynergyFormControl) => HTMLFormElement | null;
|
|
8
|
+
/** A function that returns the form control's name, which will be submitted with the form data. */
|
|
9
|
+
name: (input: SynergyFormControl) => string;
|
|
10
|
+
/** A function that returns the form control's current value. */
|
|
11
|
+
value: (input: SynergyFormControl) => unknown | unknown[];
|
|
12
|
+
/** A function that returns the form control's default value. */
|
|
13
|
+
defaultValue: (input: SynergyFormControl) => unknown | unknown[];
|
|
14
|
+
/** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */
|
|
15
|
+
disabled: (input: SynergyFormControl) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A function that maps to the form control's reportValidity() function. When the control is invalid, this will
|
|
18
|
+
* prevent submission and trigger the browser's constraint violation warning.
|
|
19
|
+
*/
|
|
20
|
+
reportValidity: (input: SynergyFormControl) => boolean;
|
|
21
|
+
/** A function that sets the form control's value */
|
|
22
|
+
setValue: (input: SynergyFormControl, value: unknown) => void;
|
|
23
|
+
/**
|
|
24
|
+
* An array of event names to listen to. When all events in the list are emitted, the control will receive validity
|
|
25
|
+
* states such as user-valid and user-invalid.user interacted validity states. */
|
|
26
|
+
assumeInteractionOn: string[];
|
|
27
|
+
}
|
|
28
|
+
/** A reactive controller to allow form controls to participate in form submission, validation, etc. */
|
|
29
|
+
export declare class FormControlController implements ReactiveController {
|
|
30
|
+
host: SynergyFormControl & ReactiveControllerHost;
|
|
31
|
+
form?: HTMLFormElement | null;
|
|
32
|
+
options: FormControlControllerOptions;
|
|
33
|
+
constructor(host: ReactiveControllerHost & SynergyFormControl, options?: Partial<FormControlControllerOptions>);
|
|
34
|
+
hostConnected(): void;
|
|
35
|
+
hostDisconnected(): void;
|
|
36
|
+
hostUpdated(): void;
|
|
37
|
+
private attachForm;
|
|
38
|
+
private detachForm;
|
|
39
|
+
private handleFormData;
|
|
40
|
+
private handleFormSubmit;
|
|
41
|
+
private handleFormReset;
|
|
42
|
+
private handleInteraction;
|
|
43
|
+
private reportFormValidity;
|
|
44
|
+
private setUserInteracted;
|
|
45
|
+
private doAction;
|
|
46
|
+
/** Returns the associated `<form>` element, if one exists. */
|
|
47
|
+
getForm(): HTMLFormElement | null;
|
|
48
|
+
/** Resets the form, restoring all the control to their default value */
|
|
49
|
+
reset(submitter?: HTMLInputElement | SynButton): void;
|
|
50
|
+
/** Submits the form, triggering validation and form data injection. */
|
|
51
|
+
submit(submitter?: HTMLInputElement | SynButton): void;
|
|
52
|
+
/**
|
|
53
|
+
* Synchronously sets the form control's validity. Call this when you know the future validity but need to update
|
|
54
|
+
* the host element immediately, i.e. before Lit updates the component in the next update.
|
|
55
|
+
*/
|
|
56
|
+
setValidity(isValid: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
|
|
59
|
+
* that affects constraint validation changes so the component receives the correct validity states.
|
|
60
|
+
*/
|
|
61
|
+
updateValidity(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Dispatches a non-bubbling, cancelable custom event of type `syn-invalid`.
|
|
64
|
+
* If the `syn-invalid` event will be cancelled then the original `invalid`
|
|
65
|
+
* event (which may have been passed as argument) will also be cancelled.
|
|
66
|
+
* If no original `invalid` event has been passed then the `syn-invalid`
|
|
67
|
+
* event will be cancelled before being dispatched.
|
|
68
|
+
*/
|
|
69
|
+
emitInvalidEvent(originalInvalidEvent?: Event): void;
|
|
70
|
+
}
|
|
71
|
+
export declare const validValidityState: ValidityState;
|
|
72
|
+
export declare const valueMissingValidityState: ValidityState;
|
|
73
|
+
export declare const customErrorValidityState: ValidityState;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/** A reactive controller that determines when slots exist. */
|
|
3
|
+
export declare class HasSlotController implements ReactiveController {
|
|
4
|
+
host: ReactiveControllerHost & Element;
|
|
5
|
+
slotNames: string[];
|
|
6
|
+
constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]);
|
|
7
|
+
private hasDefaultSlot;
|
|
8
|
+
private hasNamedSlot;
|
|
9
|
+
test(slotName: string): boolean;
|
|
10
|
+
hostConnected(): void;
|
|
11
|
+
hostDisconnected(): void;
|
|
12
|
+
private handleSlotChange;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Given a slot, this function iterates over all of its assigned element and text nodes and returns the concatenated
|
|
16
|
+
* HTML as a string. This is useful because we can't use slot.innerHTML as an alternative.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getInnerHTML(slot: HTMLSlotElement): string;
|
|
19
|
+
/**
|
|
20
|
+
* Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a
|
|
21
|
+
* string. This is useful because we can't use slot.textContent as an alternative.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getTextContent(slot: HTMLSlotElement | undefined | null): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
type EventTypeRequiresDetail<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? never : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? never : T : never : never;
|
|
3
|
+
type EventTypeDoesNotRequireDetail<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? T : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? T : never : T : T;
|
|
4
|
+
type EventTypesWithRequiredDetail = {
|
|
5
|
+
[EventType in keyof GlobalEventHandlersEventMap as EventTypeRequiresDetail<EventType>]: true;
|
|
6
|
+
};
|
|
7
|
+
type EventTypesWithoutRequiredDetail = {
|
|
8
|
+
[EventType in keyof GlobalEventHandlersEventMap as EventTypeDoesNotRequireDetail<EventType>]: true;
|
|
9
|
+
};
|
|
10
|
+
type WithRequired<T, K extends keyof T> = T & {
|
|
11
|
+
[P in K]-?: T[P];
|
|
12
|
+
};
|
|
13
|
+
type SynEventInit<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']> : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']> : WithRequired<CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>, 'detail'> : CustomEventInit : CustomEventInit;
|
|
14
|
+
type GetCustomEventType<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<unknown> ? GlobalEventHandlersEventMap[T] : CustomEvent<unknown> : CustomEvent<unknown>;
|
|
15
|
+
export default class SynergyElement extends LitElement {
|
|
16
|
+
dir: string;
|
|
17
|
+
lang: string;
|
|
18
|
+
/** Emits a custom event with more convenient defaults. */
|
|
19
|
+
emit<T extends string & keyof EventTypesWithoutRequiredDetail>(name: EventTypeDoesNotRequireDetail<T>, options?: SynEventInit<T> | undefined): GetCustomEventType<T>;
|
|
20
|
+
emit<T extends string & keyof EventTypesWithRequiredDetail>(name: EventTypeRequiresDetail<T>, options: SynEventInit<T>): GetCustomEventType<T>;
|
|
21
|
+
static version: any;
|
|
22
|
+
static define(name: string, elementConstructor?: typeof SynergyElement, options?: ElementDefinitionOptions): void;
|
|
23
|
+
static dependencies: Record<string, typeof SynergyElement>;
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
export interface SynergyFormControl extends SynergyElement {
|
|
27
|
+
name: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
defaultValue?: unknown;
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
form?: string;
|
|
33
|
+
pattern?: string;
|
|
34
|
+
min?: number | string | Date;
|
|
35
|
+
max?: number | string | Date;
|
|
36
|
+
step?: number | 'any';
|
|
37
|
+
required?: boolean;
|
|
38
|
+
minlength?: number;
|
|
39
|
+
maxlength?: number;
|
|
40
|
+
readonly validity: ValidityState;
|
|
41
|
+
readonly validationMessage: string;
|
|
42
|
+
checkValidity: () => boolean;
|
|
43
|
+
getForm: () => HTMLFormElement | null;
|
|
44
|
+
reportValidity: () => boolean;
|
|
45
|
+
setCustomValidity: (message: string) => void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SynergyFormControl } from '../synergy-element.js';
|
|
2
|
+
/** Runs a set of generic tests for Synergy form controls */
|
|
3
|
+
export declare function runFormControlBaseTests<T extends SynergyFormControl = SynergyFormControl>(tagNameOrConfig: string | {
|
|
4
|
+
tagName: string;
|
|
5
|
+
init?: (control: T) => void;
|
|
6
|
+
variantName: string;
|
|
7
|
+
}): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LitElement } from 'lit';
|
|
2
|
+
type UpdateHandler = (prev?: unknown, next?: unknown) => void;
|
|
3
|
+
type NonUndefined<A> = A extends undefined ? never : A;
|
|
4
|
+
type UpdateHandlerFunctionKeys<T extends object> = {
|
|
5
|
+
[K in keyof T]-?: NonUndefined<T[K]> extends UpdateHandler ? K : never;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
interface WatchOptions {
|
|
8
|
+
/**
|
|
9
|
+
* If true, will only start watching after the initial update/render
|
|
10
|
+
*/
|
|
11
|
+
waitUntilFirstUpdate?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Runs when observed properties change, e.g. @property or @state, but before the component updates. To wait for an
|
|
15
|
+
* update to complete after a change occurs, use `await this.updateComplete` in the handler. To start watching after the
|
|
16
|
+
* initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
*
|
|
20
|
+
* @watch('propName')
|
|
21
|
+
* handlePropChange(oldValue, newValue) {
|
|
22
|
+
* ...
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
export declare function watch(propertyName: string | string[], options?: WatchOptions): <ElemClass extends LitElement>(proto: ElemClass, decoratedFnName: UpdateHandlerFunctionKeys<ElemClass>) => void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getBasePath
|
|
3
|
+
} from "./chunks/chunk.C7624ITA.js";
|
|
4
|
+
import "./chunks/chunk.DJOAQ4JU.js";
|
|
5
|
+
|
|
6
|
+
// src/synergy-autoloader.ts
|
|
7
|
+
var observer = new MutationObserver((mutations) => {
|
|
8
|
+
for (const { addedNodes } of mutations) {
|
|
9
|
+
for (const node of addedNodes) {
|
|
10
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
11
|
+
discover(node);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
async function discover(root) {
|
|
17
|
+
const rootTagName = root instanceof Element ? root.tagName.toLowerCase() : "";
|
|
18
|
+
const rootIsSynergyElement = rootTagName == null ? void 0 : rootTagName.startsWith("syn-");
|
|
19
|
+
const tags = [...root.querySelectorAll(":not(:defined)")].map((el) => el.tagName.toLowerCase()).filter((tag) => tag.startsWith("syn-"));
|
|
20
|
+
if (rootIsSynergyElement && !customElements.get(rootTagName)) {
|
|
21
|
+
tags.push(rootTagName);
|
|
22
|
+
}
|
|
23
|
+
const tagsToRegister = [...new Set(tags)];
|
|
24
|
+
await Promise.allSettled(tagsToRegister.map((tagName) => register(tagName)));
|
|
25
|
+
}
|
|
26
|
+
function register(tagName) {
|
|
27
|
+
if (customElements.get(tagName)) {
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
}
|
|
30
|
+
const tagWithoutPrefix = tagName.replace(/^syn-/i, "");
|
|
31
|
+
const path = getBasePath(`components/${tagWithoutPrefix}/${tagWithoutPrefix}.js`);
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
import(path).then(() => resolve()).catch(() => reject(new Error(`Unable to autoload <${tagName}> from ${path}`)));
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
discover(document.body);
|
|
37
|
+
observer.observe(document.documentElement, { subtree: true, childList: true });
|
|
38
|
+
export {
|
|
39
|
+
discover
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=synergy-autoloader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/synergy-autoloader.ts"],
|
|
4
|
+
"sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { getBasePath } from './utilities/base-path.js';\n\nconst observer = new MutationObserver(mutations => {\n for (const { addedNodes } of mutations) {\n for (const node of addedNodes) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n discover(node as Element);\n }\n }\n }\n});\n\n/**\n * Checks a node for undefined elements and attempts to register them.\n */\nexport async function discover(root: Element | ShadowRoot) {\n const rootTagName = root instanceof Element ? root.tagName.toLowerCase() : '';\n const rootIsSynergyElement = rootTagName?.startsWith('syn-');\n const tags = [...root.querySelectorAll(':not(:defined)')]\n .map(el => el.tagName.toLowerCase())\n .filter(tag => tag.startsWith('syn-'));\n\n // If the root element is an undefined Synergy component, add it to the list\n if (rootIsSynergyElement && !customElements.get(rootTagName)) {\n tags.push(rootTagName);\n }\n\n // Make the list unique\n const tagsToRegister = [...new Set(tags)];\n\n await Promise.allSettled(tagsToRegister.map(tagName => register(tagName)));\n}\n\n/**\n * Registers an element by tag name.\n */\nfunction register(tagName: string): Promise<void> {\n // If the element is already defined, there's nothing more to do\n if (customElements.get(tagName)) {\n return Promise.resolve();\n }\n\n const tagWithoutPrefix = tagName.replace(/^syn-/i, '');\n const path = getBasePath(`components/${tagWithoutPrefix}/${tagWithoutPrefix}.js`);\n\n // Register it\n return new Promise((resolve, reject) => {\n import(path).then(() => resolve()).catch(() => reject(new Error(`Unable to autoload <${tagName}> from ${path}`)));\n });\n}\n\n// Initial discovery\ndiscover(document.body);\n\n// Listen for new undefined elements\nobserver.observe(document.documentElement, { subtree: true, childList: true });\n"],
|
|
5
|
+
"mappings": ";;;;;;AAQA,IAAM,WAAW,IAAI,iBAAiB,eAAa;AACjD,aAAW,EAAE,WAAW,KAAK,WAAW;AACtC,eAAW,QAAQ,YAAY;AAC7B,UAAI,KAAK,aAAa,KAAK,cAAc;AACvC,iBAAS,IAAe;AAAA,MAC1B;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAKD,eAAsB,SAAS,MAA4B;AACzD,QAAM,cAAc,gBAAgB,UAAU,KAAK,QAAQ,YAAY,IAAI;AAC3E,QAAM,uBAAuB,2CAAa,WAAW;AACrD,QAAM,OAAO,CAAC,GAAG,KAAK,iBAAiB,gBAAgB,CAAC,EACrD,IAAI,QAAM,GAAG,QAAQ,YAAY,CAAC,EAClC,OAAO,SAAO,IAAI,WAAW,MAAM,CAAC;AAGvC,MAAI,wBAAwB,CAAC,eAAe,IAAI,WAAW,GAAG;AAC5D,SAAK,KAAK,WAAW;AAAA,EACvB;AAGA,QAAM,iBAAiB,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC;AAExC,QAAM,QAAQ,WAAW,eAAe,IAAI,aAAW,SAAS,OAAO,CAAC,CAAC;AAC3E;AAKA,SAAS,SAAS,SAAgC;AAEhD,MAAI,eAAe,IAAI,OAAO,GAAG;AAC/B,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAEA,QAAM,mBAAmB,QAAQ,QAAQ,UAAU,EAAE;AACrD,QAAM,OAAO,YAAY,cAAc,gBAAgB,IAAI,gBAAgB,KAAK;AAGhF,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,WAAO,MAAM,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM,MAAM,OAAO,IAAI,MAAM,uBAAuB,OAAO,UAAU,IAAI,EAAE,CAAC,CAAC;AAAA,EAClH,CAAC;AACH;AAGA,SAAS,SAAS,IAAI;AAGtB,SAAS,QAAQ,SAAS,iBAAiB,EAAE,SAAS,MAAM,WAAW,KAAK,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/synergy.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
input_default
|
|
3
|
+
} from "./chunks/chunk.EW2JZPYV.js";
|
|
4
|
+
import {
|
|
5
|
+
getFormControls,
|
|
6
|
+
serialize
|
|
7
|
+
} from "./chunks/chunk.WTCUSH7V.js";
|
|
8
|
+
import "./chunks/chunk.BQPK6UKU.js";
|
|
9
|
+
import "./chunks/chunk.Q77OTWF2.js";
|
|
10
|
+
import "./chunks/chunk.ILONRPL4.js";
|
|
11
|
+
import {
|
|
12
|
+
button_default
|
|
13
|
+
} from "./chunks/chunk.7EGSHKGV.js";
|
|
14
|
+
import "./chunks/chunk.FUYWF5Y2.js";
|
|
15
|
+
import "./chunks/chunk.2FIY3TX5.js";
|
|
16
|
+
import "./chunks/chunk.N2I6HVX3.js";
|
|
17
|
+
import "./chunks/chunk.XGXFE6IF.js";
|
|
18
|
+
import "./chunks/chunk.R6VNLE6N.js";
|
|
19
|
+
import "./chunks/chunk.A3SKDWCT.js";
|
|
20
|
+
import "./chunks/chunk.WDCAHRYG.js";
|
|
21
|
+
import "./chunks/chunk.P22LQI5J.js";
|
|
22
|
+
import "./chunks/chunk.DREO4ZTN.js";
|
|
23
|
+
import "./chunks/chunk.5PZUAKCS.js";
|
|
24
|
+
import "./chunks/chunk.SLLG4KJR.js";
|
|
25
|
+
import "./chunks/chunk.BREU4ILT.js";
|
|
26
|
+
import "./chunks/chunk.5OIEI73E.js";
|
|
27
|
+
import "./chunks/chunk.6C4JXZZN.js";
|
|
28
|
+
import "./chunks/chunk.U7ZJ22QM.js";
|
|
29
|
+
import "./chunks/chunk.C7624ITA.js";
|
|
30
|
+
import "./chunks/chunk.O7USYXBT.js";
|
|
31
|
+
import "./chunks/chunk.DJOAQ4JU.js";
|
|
32
|
+
export {
|
|
33
|
+
button_default as SynButton,
|
|
34
|
+
input_default as SynInput,
|
|
35
|
+
getFormControls,
|
|
36
|
+
serialize
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=synergy.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerTranslation
|
|
3
|
+
} from "../chunks/chunk.R6VNLE6N.js";
|
|
4
|
+
import "../chunks/chunk.A3SKDWCT.js";
|
|
5
|
+
import "../chunks/chunk.DJOAQ4JU.js";
|
|
6
|
+
|
|
7
|
+
// src/translations/de.ts
|
|
8
|
+
var translation = {
|
|
9
|
+
$code: "de",
|
|
10
|
+
$name: "Deutsch",
|
|
11
|
+
$dir: "ltr",
|
|
12
|
+
carousel: "Karussell",
|
|
13
|
+
clearEntry: "Eingabe l\xF6schen",
|
|
14
|
+
close: "Schlie\xDFen",
|
|
15
|
+
copied: "Kopiert",
|
|
16
|
+
copy: "Kopieren",
|
|
17
|
+
currentValue: "Aktueller Wert",
|
|
18
|
+
error: "Fehler",
|
|
19
|
+
goToSlide: (slide, count) => `Zu Folie ${slide} von ${count} gehen`,
|
|
20
|
+
hidePassword: "Passwort verbergen",
|
|
21
|
+
loading: "Wird geladen",
|
|
22
|
+
nextSlide: "N\xE4chste Folie",
|
|
23
|
+
numOptionsSelected: (num) => {
|
|
24
|
+
if (num === 0)
|
|
25
|
+
return "Keine Optionen ausgew\xE4hlt";
|
|
26
|
+
if (num === 1)
|
|
27
|
+
return "1 Option ausgew\xE4hlt";
|
|
28
|
+
return `${num} Optionen ausgew\xE4hlt`;
|
|
29
|
+
},
|
|
30
|
+
previousSlide: "Vorherige Folie",
|
|
31
|
+
progress: "Fortschritt",
|
|
32
|
+
remove: "Entfernen",
|
|
33
|
+
resize: "Gr\xF6\xDFe \xE4ndern",
|
|
34
|
+
scrollToEnd: "Zum Ende scrollen",
|
|
35
|
+
scrollToStart: "Zum Anfang scrollen",
|
|
36
|
+
selectAColorFromTheScreen: "Farbe vom Bildschirm ausw\xE4hlen",
|
|
37
|
+
showPassword: "Passwort anzeigen",
|
|
38
|
+
slideNum: (slide) => `Folie ${slide}`,
|
|
39
|
+
toggleColorFormat: "Farbformat umschalten"
|
|
40
|
+
};
|
|
41
|
+
registerTranslation(translation);
|
|
42
|
+
var de_default = translation;
|
|
43
|
+
export {
|
|
44
|
+
de_default as default
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=de.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/translations/de.ts"],
|
|
4
|
+
"sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { registerTranslation } from '../utilities/localize.js';\nimport type { Translation } from '../utilities/localize.js';\n\nconst translation: Translation = {\n $code: 'de',\n $name: 'Deutsch',\n $dir: 'ltr',\n\n carousel: 'Karussell',\n clearEntry: 'Eingabe l\u00F6schen',\n close: 'Schlie\u00DFen',\n copied: 'Kopiert',\n copy: 'Kopieren',\n currentValue: 'Aktueller Wert',\n error: 'Fehler',\n goToSlide: (slide, count) => `Zu Folie ${slide} von ${count} gehen`,\n hidePassword: 'Passwort verbergen',\n loading: 'Wird geladen',\n nextSlide: 'N\u00E4chste Folie',\n numOptionsSelected: num => {\n if (num === 0) return 'Keine Optionen ausgew\u00E4hlt';\n if (num === 1) return '1 Option ausgew\u00E4hlt';\n return `${num} Optionen ausgew\u00E4hlt`;\n },\n previousSlide: 'Vorherige Folie',\n progress: 'Fortschritt',\n remove: 'Entfernen',\n resize: 'Gr\u00F6\u00DFe \u00E4ndern',\n scrollToEnd: 'Zum Ende scrollen',\n scrollToStart: 'Zum Anfang scrollen',\n selectAColorFromTheScreen: 'Farbe vom Bildschirm ausw\u00E4hlen',\n showPassword: 'Passwort anzeigen',\n slideNum: slide => `Folie ${slide}`,\n toggleColorFormat: 'Farbformat umschalten'\n};\n\nregisterTranslation(translation);\n\nexport default translation;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AASA,IAAM,cAA2B;AAAA,EAC/B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EAEN,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA,EACP,WAAW,CAAC,OAAO,UAAU,YAAY,KAAK,QAAQ,KAAK;AAAA,EAC3D,cAAc;AAAA,EACd,SAAS;AAAA,EACT,WAAW;AAAA,EACX,oBAAoB,SAAO;AACzB,QAAI,QAAQ;AAAG,aAAO;AACtB,QAAI,QAAQ;AAAG,aAAO;AACtB,WAAO,GAAG,GAAG;AAAA,EACf;AAAA,EACA,eAAe;AAAA,EACf,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,2BAA2B;AAAA,EAC3B,cAAc;AAAA,EACd,UAAU,WAAS,SAAS,KAAK;AAAA,EACjC,mBAAmB;AACrB;AAEA,oBAAoB,WAAW;AAE/B,IAAO,aAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Sets the library's base path to the specified directory. */
|
|
2
|
+
export declare function setBasePath(path: string): void;
|
|
3
|
+
/**
|
|
4
|
+
* Gets the library's base path.
|
|
5
|
+
*
|
|
6
|
+
* The base path is used to load assets such as icons and images, so it needs to be set for components to work properly.
|
|
7
|
+
* By default, this script will look for a script ending in synergy.js or synergy-autoloader.js and set the base path
|
|
8
|
+
* to the directory that contains that file. To override this behavior, you can add the data-synergy attribute to any
|
|
9
|
+
* script on the page (it probably makes the most sense to attach it to the Synergy script, but it could also be on a
|
|
10
|
+
* bundle). The value can be a local folder or it can point to a CORS-enabled endpoint such as a CDN.
|
|
11
|
+
*
|
|
12
|
+
* <script src="bundle.js" data-synergy="/custom/base/path"></script>
|
|
13
|
+
*
|
|
14
|
+
* Alternatively, you can set the base path manually using the exported setBasePath() function.
|
|
15
|
+
*
|
|
16
|
+
* @param subpath - An optional path to append to the base path.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getBasePath(subpath?: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializes a form and returns a plain object. If a form control with the same name appears more than once, the
|
|
3
|
+
* property will be converted to an array.
|
|
4
|
+
*/
|
|
5
|
+
export declare function serialize(form: HTMLFormElement): Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns all form controls that are associated with the specified form. Includes both native and Synergy form
|
|
8
|
+
* controls. Use this function in lieu of the `HTMLFormElement.elements` property, which doesn't recognize Synergy
|
|
9
|
+
* form controls.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getFormControls(form: HTMLFormElement): Element[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import '../translations/en.js';
|
|
2
|
+
import { LocalizeController as DefaultLocalizationController } from '@shoelace-style/localize';
|
|
3
|
+
import type { Translation as DefaultTranslation } from '@shoelace-style/localize';
|
|
4
|
+
export declare class LocalizeController extends DefaultLocalizationController<Translation> {
|
|
5
|
+
}
|
|
6
|
+
export { registerTranslation } from '@shoelace-style/localize';
|
|
7
|
+
export interface Translation extends DefaultTranslation {
|
|
8
|
+
$code: string;
|
|
9
|
+
$name: string;
|
|
10
|
+
$dir: 'ltr' | 'rtl';
|
|
11
|
+
carousel: string;
|
|
12
|
+
clearEntry: string;
|
|
13
|
+
close: string;
|
|
14
|
+
copied: string;
|
|
15
|
+
copy: string;
|
|
16
|
+
currentValue: string;
|
|
17
|
+
error: string;
|
|
18
|
+
goToSlide: (slide: number, count: number) => string;
|
|
19
|
+
hidePassword: string;
|
|
20
|
+
loading: string;
|
|
21
|
+
nextSlide: string;
|
|
22
|
+
numOptionsSelected: (num: number) => string;
|
|
23
|
+
previousSlide: string;
|
|
24
|
+
progress: string;
|
|
25
|
+
remove: string;
|
|
26
|
+
resize: string;
|
|
27
|
+
scrollToEnd: string;
|
|
28
|
+
scrollToStart: string;
|
|
29
|
+
selectAColorFromTheScreen: string;
|
|
30
|
+
showPassword: string;
|
|
31
|
+
slideNum: (slide: number) => string;
|
|
32
|
+
toggleColorFormat: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LocalizeController,
|
|
3
|
+
registerTranslation
|
|
4
|
+
} from "../chunks/chunk.R6VNLE6N.js";
|
|
5
|
+
import "../chunks/chunk.A3SKDWCT.js";
|
|
6
|
+
import "../chunks/chunk.DJOAQ4JU.js";
|
|
7
|
+
export {
|
|
8
|
+
LocalizeController,
|
|
9
|
+
registerTranslation
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=localize.js.map
|