@ratiosolver/flick 0.2.2 → 0.2.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/dist/components/app.js +1 -1
- package/dist/components/app.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/app.d.ts +0 -61
- package/dist/app.js +0 -61
- package/dist/app.js.map +0 -1
- package/dist/component.d.ts +0 -120
- package/dist/component.js +0 -161
- package/dist/component.js.map +0 -1
- package/dist/components/brand.d.ts +0 -15
- package/dist/components/brand.js +0 -39
- package/dist/components/brand.js.map +0 -1
- package/dist/components/checkbox.d.ts +0 -49
- package/dist/components/checkbox.js +0 -77
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/sidebar.d.ts +0 -5
- package/dist/components/sidebar.js +0 -36
- package/dist/components/sidebar.js.map +0 -1
- package/dist/utils/blink.d.ts +0 -14
- package/dist/utils/blink.js +0 -28
- package/dist/utils/blink.js.map +0 -1
- package/dist/utils/connection.d.ts +0 -102
- package/dist/utils/connection.js +0 -177
- package/dist/utils/connection.js.map +0 -1
- package/dist/utils/selector.d.ts +0 -59
- package/dist/utils/selector.js +0 -44
- package/dist/utils/selector.js.map +0 -1
- package/dist/utils/settings.d.ts +0 -61
- package/dist/utils/settings.js +0 -72
- package/dist/utils/settings.js.map +0 -1
- package/dist/utils/user_components.d.ts +0 -83
- package/dist/utils/user_components.js +0 -358
- package/dist/utils/user_components.js.map +0 -1
package/dist/components/brand.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Component } from "../app";
|
|
2
|
-
export class BrandComponent extends Component {
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new brand component for the navigation bar.
|
|
5
|
-
*
|
|
6
|
-
* @param name - The display name of the brand. Defaults to 'Flick'.
|
|
7
|
-
* @param icon - The source URL or path for the brand icon. Defaults to 'favicon.ico'.
|
|
8
|
-
* @param icon_width - The width of the brand icon in pixels. Defaults to 32.
|
|
9
|
-
* @param icon_height - The height of the brand icon in pixels. Defaults to 32.
|
|
10
|
-
*
|
|
11
|
-
* The constructor initializes the brand element with an icon and text,
|
|
12
|
-
* styled and aligned for use in a navigation bar.
|
|
13
|
-
*/
|
|
14
|
-
constructor(name = 'Flick', icon = 'favicon.ico', icon_width = 32, icon_height = 32) {
|
|
15
|
-
super(undefined, document.createElement('a'));
|
|
16
|
-
this.element.classList.add('navbar-brand');
|
|
17
|
-
this.element.href = '#';
|
|
18
|
-
const brand_container = document.createElement('div');
|
|
19
|
-
brand_container.style.display = 'flex';
|
|
20
|
-
brand_container.style.alignItems = 'center';
|
|
21
|
-
brand_container.style.gap = '0.5rem'; // Add space between icon and text
|
|
22
|
-
const brand_icon = document.createElement('img');
|
|
23
|
-
brand_icon.src = icon;
|
|
24
|
-
brand_icon.alt = name;
|
|
25
|
-
brand_icon.width = icon_width;
|
|
26
|
-
brand_icon.height = icon_height;
|
|
27
|
-
brand_icon.classList.add('d-inline-block', 'align-text-top');
|
|
28
|
-
brand_container.appendChild(brand_icon);
|
|
29
|
-
if (name) {
|
|
30
|
-
brand_icon.classList.add('me-1');
|
|
31
|
-
const brand_text = document.createElement('span');
|
|
32
|
-
brand_text.textContent = name;
|
|
33
|
-
brand_text.style.fontWeight = '500'; // Make text slightly bolder
|
|
34
|
-
brand_container.appendChild(brand_text);
|
|
35
|
-
}
|
|
36
|
-
this.element.appendChild(brand_container);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=brand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/components/brand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,MAAM,OAAO,cAAe,SAAQ,SAAkC;IAEpE;;;;;;;;;;OAUG;IACH,YAAY,OAAe,OAAO,EAAE,OAAe,aAAa,EAAE,aAAqB,EAAE,EAAE,cAAs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CACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PayloadComponent } from "../component";
|
|
2
|
-
/**
|
|
3
|
-
* A generic checkbox UI component that associates a payload with a checkbox input element.
|
|
4
|
-
*
|
|
5
|
-
* This component renders a checkbox with an optional label and allows tracking its checked state.
|
|
6
|
-
* It provides hooks (`selected` and `unselected`) for custom behavior when the checkbox is toggled.
|
|
7
|
-
*
|
|
8
|
-
* @typeParam P - The type of the payload associated with the checkbox.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* class MyCheckbox extends CheckboxComponent<MyPayloadType> {
|
|
13
|
-
* selected() {
|
|
14
|
-
* // Custom logic when checked
|
|
15
|
-
* }
|
|
16
|
-
* unselected() {
|
|
17
|
-
* // Custom logic when unchecked
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare class CheckboxComponent<P> extends PayloadComponent<HTMLDivElement, P> {
|
|
23
|
-
private readonly checkbox;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new CheckboxComponent.
|
|
26
|
-
*
|
|
27
|
-
* @param payload The payload associated with the checkbox.
|
|
28
|
-
* @param id_factory A function to generate the ID for the checkbox based on the payload.
|
|
29
|
-
* @param selected Whether the checkbox is initially selected.
|
|
30
|
-
* @param label Optional label for the checkbox.
|
|
31
|
-
*/
|
|
32
|
-
constructor(payload: P, id_factory: (payload: P) => string, selected?: boolean, label?: string);
|
|
33
|
-
/**
|
|
34
|
-
* Sets the checked state of the checkbox.
|
|
35
|
-
*
|
|
36
|
-
* @param checked The new checked state.
|
|
37
|
-
*/
|
|
38
|
-
set_checked(checked: boolean): void;
|
|
39
|
-
/**
|
|
40
|
-
* Callback when the checkbox is selected.
|
|
41
|
-
* Override this method to define custom behavior when the checkbox is selected.
|
|
42
|
-
*/
|
|
43
|
-
selected(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Callback when the checkbox is unselected.
|
|
46
|
-
* Override this method to define custom behavior when the checkbox is unselected.
|
|
47
|
-
*/
|
|
48
|
-
unselected(): void;
|
|
49
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { PayloadComponent } from "../component";
|
|
2
|
-
/**
|
|
3
|
-
* A generic checkbox UI component that associates a payload with a checkbox input element.
|
|
4
|
-
*
|
|
5
|
-
* This component renders a checkbox with an optional label and allows tracking its checked state.
|
|
6
|
-
* It provides hooks (`selected` and `unselected`) for custom behavior when the checkbox is toggled.
|
|
7
|
-
*
|
|
8
|
-
* @typeParam P - The type of the payload associated with the checkbox.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* class MyCheckbox extends CheckboxComponent<MyPayloadType> {
|
|
13
|
-
* selected() {
|
|
14
|
-
* // Custom logic when checked
|
|
15
|
-
* }
|
|
16
|
-
* unselected() {
|
|
17
|
-
* // Custom logic when unchecked
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export class CheckboxComponent extends PayloadComponent {
|
|
23
|
-
/**
|
|
24
|
-
* Creates a new CheckboxComponent.
|
|
25
|
-
*
|
|
26
|
-
* @param payload The payload associated with the checkbox.
|
|
27
|
-
* @param id_factory A function to generate the ID for the checkbox based on the payload.
|
|
28
|
-
* @param selected Whether the checkbox is initially selected.
|
|
29
|
-
* @param label Optional label for the checkbox.
|
|
30
|
-
*/
|
|
31
|
-
constructor(payload, id_factory, selected = false, label) {
|
|
32
|
-
super(document.createElement('div'), payload);
|
|
33
|
-
this.node.classList.add('form-check');
|
|
34
|
-
this.checkbox = document.createElement('input');
|
|
35
|
-
this.checkbox.type = 'checkbox';
|
|
36
|
-
this.checkbox.classList.add('form-check-input');
|
|
37
|
-
this.checkbox.checked = selected;
|
|
38
|
-
this.checkbox.id = id_factory(payload);
|
|
39
|
-
this.node.appendChild(this.checkbox);
|
|
40
|
-
if (label) {
|
|
41
|
-
const labelElement = document.createElement('label');
|
|
42
|
-
labelElement.classList.add('form-check-label');
|
|
43
|
-
labelElement.textContent = label;
|
|
44
|
-
labelElement.setAttribute('for', this.checkbox.id);
|
|
45
|
-
this.node.appendChild(labelElement);
|
|
46
|
-
}
|
|
47
|
-
this.checkbox.addEventListener('click', () => {
|
|
48
|
-
if (this.checkbox.checked)
|
|
49
|
-
this.selected();
|
|
50
|
-
else
|
|
51
|
-
this.unselected();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Sets the checked state of the checkbox.
|
|
56
|
-
*
|
|
57
|
-
* @param checked The new checked state.
|
|
58
|
-
*/
|
|
59
|
-
set_checked(checked) {
|
|
60
|
-
this.checkbox.checked = checked;
|
|
61
|
-
if (checked)
|
|
62
|
-
this.selected();
|
|
63
|
-
else
|
|
64
|
-
this.unselected();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Callback when the checkbox is selected.
|
|
68
|
-
* Override this method to define custom behavior when the checkbox is selected.
|
|
69
|
-
*/
|
|
70
|
-
selected() { }
|
|
71
|
-
/**
|
|
72
|
-
* Callback when the checkbox is unselected.
|
|
73
|
-
* Override this method to define custom behavior when the checkbox is unselected.
|
|
74
|
-
*/
|
|
75
|
-
unselected() { }
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=checkbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/components/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,iBAAqB,SAAQ,gBAAmC;IAI3E;;;;;;;OAOG;IACH,YAAY,OAAU,EAAE,UAAkC,EAAE,WAAoB,KAAK,EAAE,KAAc;QACnG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,OAAO,CA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EhB,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,QAAQ,KAAW,CAAC;IAEpB;;;OAGG;IACH,UAAU,KAAW,CAAC;CACvB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component";
|
|
2
|
-
import { Selector, SelectorGroup } from "../utils/selector";
|
|
3
|
-
export declare class Sidebar extends Component<HTMLDivElement> {
|
|
4
|
-
constructor(group: SelectorGroup, top: Map<HTMLAnchorElement, Selector>, bottom?: Map<HTMLAnchorElement, Selector>);
|
|
5
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Component } from "../component";
|
|
2
|
-
export class Sidebar extends Component {
|
|
3
|
-
constructor(group, top, bottom) {
|
|
4
|
-
super(document.createElement('div'));
|
|
5
|
-
this.node.classList.add('d-flex', 'flex-column', 'flex-shrink-0', 'p-3', 'bg-light');
|
|
6
|
-
this.node.style.width = '280px';
|
|
7
|
-
this.node.style.height = 'calc(100vh - 60px)';
|
|
8
|
-
const ul = document.createElement('ul');
|
|
9
|
-
ul.classList.add('nav', 'nav-pills', 'flex-column', 'mb-auto');
|
|
10
|
-
for (const [a, sel] of top) {
|
|
11
|
-
const li = document.createElement('li');
|
|
12
|
-
li.classList.add('nav-item');
|
|
13
|
-
a.classList.add('nav-link');
|
|
14
|
-
group.add_selector(sel);
|
|
15
|
-
li.appendChild(a);
|
|
16
|
-
ul.appendChild(li);
|
|
17
|
-
}
|
|
18
|
-
this.node.appendChild(ul);
|
|
19
|
-
if (bottom) {
|
|
20
|
-
const hr = document.createElement('hr');
|
|
21
|
-
this.node.appendChild(hr);
|
|
22
|
-
const footer_ul = document.createElement('ul');
|
|
23
|
-
footer_ul.classList.add('nav', 'nav-pills', 'flex-column', 'mb-0');
|
|
24
|
-
for (const [a, sel] of bottom) {
|
|
25
|
-
const li = document.createElement('li');
|
|
26
|
-
li.classList.add('nav-item');
|
|
27
|
-
a.classList.add('nav-link');
|
|
28
|
-
group.add_selector(sel);
|
|
29
|
-
li.appendChild(a);
|
|
30
|
-
footer_ul.appendChild(li);
|
|
31
|
-
}
|
|
32
|
-
this.node.appendChild(footer_ul);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","sourceRoot":"","sources":["../../src/components/sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,OAAQ,SAAQ,SAAyB;IAEpD,YAAY,KAAoB,EAAE,GAAqC,EAAE,MAAyC;QAChH,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;QACrF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC;QAE9C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACxC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAE/D,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;YAC3B,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACxC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAE7B,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5B,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAExB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAClB,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAE1B,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAE1B,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC/C,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;YAEnE,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC;gBAC9B,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;gBACxC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAE7B,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAC5B,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;gBAExB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBAClB,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;CACF"}
|
package/dist/utils/blink.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds a custom CSS class to one or more HTML elements for a specified duration,
|
|
3
|
-
* creating a temporary visual effect.
|
|
4
|
-
*
|
|
5
|
-
* @param elements - A single HTML element or an array of elements to apply the effect to.
|
|
6
|
-
* @param options - Configuration options for the blinking effect:
|
|
7
|
-
* - className: The CSS class to apply (defaults to 'blink')
|
|
8
|
-
* - duration: The duration in milliseconds for the effect (defaults to 500ms)
|
|
9
|
-
* @returns A function that can be called to cancel the effect before the duration expires
|
|
10
|
-
*/
|
|
11
|
-
export declare function blink(elements: HTMLElement | HTMLElement[], options?: {
|
|
12
|
-
className?: string;
|
|
13
|
-
duration?: number;
|
|
14
|
-
}): () => void;
|
package/dist/utils/blink.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adds a custom CSS class to one or more HTML elements for a specified duration,
|
|
3
|
-
* creating a temporary visual effect.
|
|
4
|
-
*
|
|
5
|
-
* @param elements - A single HTML element or an array of elements to apply the effect to.
|
|
6
|
-
* @param options - Configuration options for the blinking effect:
|
|
7
|
-
* - className: The CSS class to apply (defaults to 'blink')
|
|
8
|
-
* - duration: The duration in milliseconds for the effect (defaults to 500ms)
|
|
9
|
-
* @returns A function that can be called to cancel the effect before the duration expires
|
|
10
|
-
*/
|
|
11
|
-
export function blink(elements, options = {}) {
|
|
12
|
-
const className = options.className || 'blink';
|
|
13
|
-
const duration = options.duration || 500;
|
|
14
|
-
// Convert single element to array for consistent handling
|
|
15
|
-
const elementArray = Array.isArray(elements) ? elements : [elements];
|
|
16
|
-
// Add the class to all elements
|
|
17
|
-
elementArray.forEach(el => el.classList.add(className));
|
|
18
|
-
// Set a single timeout for all elements
|
|
19
|
-
const timeoutId = setTimeout(() => {
|
|
20
|
-
elementArray.forEach(el => el.classList.remove(className));
|
|
21
|
-
}, duration);
|
|
22
|
-
// Return a cancellation function
|
|
23
|
-
return () => {
|
|
24
|
-
clearTimeout(timeoutId);
|
|
25
|
-
elementArray.forEach(el => el.classList.remove(className));
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=blink.js.map
|
package/dist/utils/blink.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blink.js","sourceRoot":"","sources":["../../src/utils/blink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,QAAqC,EAAE,UAAqD,EAAE;IAClH,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,GAAG,CAAC;IAEzC,0DAA0D;IAC1D,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAErE,gCAAgC;IAChC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IAExD,wCAAwC;IACxC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;QAChC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7D,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEb,iCAAiC;IACjC,OAAO,GAAG,EAAE;QACV,YAAY,CAAC,SAAS,CAAC,CAAC;QACxB,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Singleton class that manages the connection to the server.
|
|
3
|
-
*/
|
|
4
|
-
export declare class Connection {
|
|
5
|
-
private static instance;
|
|
6
|
-
private socket;
|
|
7
|
-
private connection_listeners;
|
|
8
|
-
private token;
|
|
9
|
-
private constructor();
|
|
10
|
-
static get_instance(): Connection;
|
|
11
|
-
/**
|
|
12
|
-
* Connects to the server.
|
|
13
|
-
*
|
|
14
|
-
* @param token Optional token to use for the connection.
|
|
15
|
-
* @param remember_token Whether to remember the token.
|
|
16
|
-
* @param timeout Timeout in milliseconds to wait before reconnecting.
|
|
17
|
-
*/
|
|
18
|
-
connect(token?: string | null, remember_token?: boolean, timeout?: number): void;
|
|
19
|
-
/**
|
|
20
|
-
* Logs in a user.
|
|
21
|
-
*
|
|
22
|
-
* @param username Username.
|
|
23
|
-
* @param password Password.
|
|
24
|
-
* @param remember_token Whether to remember the token.
|
|
25
|
-
* @returns Whether the login was successful.
|
|
26
|
-
*/
|
|
27
|
-
login(username: string, password: string, remember_token?: boolean): Promise<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new user.
|
|
30
|
-
*
|
|
31
|
-
* @param username Username for the new user.
|
|
32
|
-
* @param password Password for the new user.
|
|
33
|
-
* @param personal_data Additional user data to store.
|
|
34
|
-
* @param remember_token Whether to remember the token.
|
|
35
|
-
* @param token Optional token to use for the request.
|
|
36
|
-
* @returns Whether the user creation was successful.
|
|
37
|
-
*/
|
|
38
|
-
create_user(username: string, password: string, personal_data?: Record<string, any>, remember_token?: boolean): Promise<boolean>;
|
|
39
|
-
/**
|
|
40
|
-
* Logs out the user.
|
|
41
|
-
*/
|
|
42
|
-
logout(): void;
|
|
43
|
-
/**
|
|
44
|
-
* Checks whether the WebSocket connection is currently open.
|
|
45
|
-
*
|
|
46
|
-
* @returns {boolean} `true` if the socket exists and its ready state is `WebSocket.OPEN`, otherwise `false`.
|
|
47
|
-
*/
|
|
48
|
-
is_connected(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Returns the current token.
|
|
51
|
-
*
|
|
52
|
-
* @returns {string | null} The current token, or `null` if not set.
|
|
53
|
-
*/
|
|
54
|
-
get_token(): string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Adds a connection listener.
|
|
57
|
-
*
|
|
58
|
-
* @param listener Connection listener to add.
|
|
59
|
-
*/
|
|
60
|
-
add_connection_listener(listener: ConnectionListener): void;
|
|
61
|
-
/**
|
|
62
|
-
* Removes a connection listener.
|
|
63
|
-
*
|
|
64
|
-
* @param listener Connection listener to remove.
|
|
65
|
-
*/
|
|
66
|
-
remove_connection_listener(listener: ConnectionListener): void;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Interface that defines the methods that a connection listener must implement.
|
|
70
|
-
*/
|
|
71
|
-
export interface ConnectionListener {
|
|
72
|
-
/**
|
|
73
|
-
* Called when the connection to the server is established.
|
|
74
|
-
*/
|
|
75
|
-
connected(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Called when the user is logged in.
|
|
78
|
-
*
|
|
79
|
-
* @param info Information about the logged-in user.
|
|
80
|
-
*/
|
|
81
|
-
logged_in(info: any): void;
|
|
82
|
-
/**
|
|
83
|
-
* Called when a message is received from the server.
|
|
84
|
-
*
|
|
85
|
-
* @param message Message received from the server.
|
|
86
|
-
*/
|
|
87
|
-
received_message(message: any): void;
|
|
88
|
-
/**
|
|
89
|
-
* Called when the user is logged out.
|
|
90
|
-
*/
|
|
91
|
-
logged_out(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Called when the connection to the server is closed.
|
|
94
|
-
*/
|
|
95
|
-
disconnected(): void;
|
|
96
|
-
/**
|
|
97
|
-
* Called when an error occurs in the connection to the server.
|
|
98
|
-
*
|
|
99
|
-
* @param error Error that occurred.
|
|
100
|
-
*/
|
|
101
|
-
connection_error(error: any): void;
|
|
102
|
-
}
|
package/dist/utils/connection.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { Settings } from "./settings";
|
|
11
|
-
/**
|
|
12
|
-
* Singleton class that manages the connection to the server.
|
|
13
|
-
*/
|
|
14
|
-
export class Connection {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.socket = null;
|
|
17
|
-
this.connection_listeners = new Set();
|
|
18
|
-
this.token = null;
|
|
19
|
-
console.debug('localStorage available: ', typeof localStorage !== 'undefined');
|
|
20
|
-
console.debug('localStorage token: ', localStorage.getItem('token'));
|
|
21
|
-
}
|
|
22
|
-
static get_instance() {
|
|
23
|
-
if (!Connection.instance)
|
|
24
|
-
Connection.instance = new Connection();
|
|
25
|
-
return Connection.instance;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Connects to the server.
|
|
29
|
-
*
|
|
30
|
-
* @param token Optional token to use for the connection.
|
|
31
|
-
* @param remember_token Whether to remember the token.
|
|
32
|
-
* @param timeout Timeout in milliseconds to wait before reconnecting.
|
|
33
|
-
*/
|
|
34
|
-
connect(token = null, remember_token = false, timeout = 5000) {
|
|
35
|
-
if (this.socket)
|
|
36
|
-
this.socket.close();
|
|
37
|
-
console.info('Connecting to server: ', Settings.get_instance().get_ws_host());
|
|
38
|
-
this.socket = new WebSocket(Settings.get_instance().get_ws_host());
|
|
39
|
-
this.socket.onopen = () => {
|
|
40
|
-
console.info('Connected to server');
|
|
41
|
-
for (const listener of this.connection_listeners) {
|
|
42
|
-
listener.connected();
|
|
43
|
-
}
|
|
44
|
-
if (token)
|
|
45
|
-
this.socket.send(JSON.stringify({ msg_type: 'login', token }));
|
|
46
|
-
};
|
|
47
|
-
this.socket.onmessage = (event) => {
|
|
48
|
-
console.trace('Received message from server: ', event.data);
|
|
49
|
-
const message = JSON.parse(event.data);
|
|
50
|
-
if (message.msg_type === 'login') {
|
|
51
|
-
this.token = token;
|
|
52
|
-
if (remember_token)
|
|
53
|
-
localStorage.setItem('token', token);
|
|
54
|
-
for (const listener of this.connection_listeners) {
|
|
55
|
-
listener.logged_in(message.personal_data);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
else
|
|
59
|
-
for (const listener of this.connection_listeners) {
|
|
60
|
-
listener.received_message(message);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
this.socket.onclose = () => {
|
|
64
|
-
console.info('Disconnected from server');
|
|
65
|
-
for (const listener of this.connection_listeners) {
|
|
66
|
-
listener.disconnected();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
this.socket.onerror = (ev) => {
|
|
70
|
-
console.error('Connection error: ', ev);
|
|
71
|
-
for (const listener of this.connection_listeners) {
|
|
72
|
-
listener.connection_error(ev);
|
|
73
|
-
}
|
|
74
|
-
setTimeout(() => this.connect(token, remember_token, timeout), timeout);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Logs in a user.
|
|
79
|
-
*
|
|
80
|
-
* @param username Username.
|
|
81
|
-
* @param password Password.
|
|
82
|
-
* @param remember_token Whether to remember the token.
|
|
83
|
-
* @returns Whether the login was successful.
|
|
84
|
-
*/
|
|
85
|
-
login(username_1, password_1) {
|
|
86
|
-
return __awaiter(this, arguments, void 0, function* (username, password, remember_token = false) {
|
|
87
|
-
console.debug('Logging in user: ', username);
|
|
88
|
-
const response = yield fetch(Settings.get_instance().get_host() + '/login', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ username: username, password: password }) });
|
|
89
|
-
if (response.ok) { // Login successful
|
|
90
|
-
const data = yield response.json();
|
|
91
|
-
this.connect(data.token, remember_token);
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
else { // Login failed
|
|
95
|
-
console.error('Login failed: ', response.statusText);
|
|
96
|
-
for (const listener of this.connection_listeners)
|
|
97
|
-
listener.connection_error(new Event(response.statusText));
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Creates a new user.
|
|
104
|
-
*
|
|
105
|
-
* @param username Username for the new user.
|
|
106
|
-
* @param password Password for the new user.
|
|
107
|
-
* @param personal_data Additional user data to store.
|
|
108
|
-
* @param remember_token Whether to remember the token.
|
|
109
|
-
* @param token Optional token to use for the request.
|
|
110
|
-
* @returns Whether the user creation was successful.
|
|
111
|
-
*/
|
|
112
|
-
create_user(username_1, password_1) {
|
|
113
|
-
return __awaiter(this, arguments, void 0, function* (username, password, personal_data = {}, remember_token = true) {
|
|
114
|
-
console.debug('Creating new user: ', username);
|
|
115
|
-
const headers = { 'content-type': 'application/json' };
|
|
116
|
-
if (this.token)
|
|
117
|
-
headers['authorization'] = `Bearer ${this.token}`;
|
|
118
|
-
const body = { username, password };
|
|
119
|
-
if (Object.keys(personal_data).length > 0)
|
|
120
|
-
body.user_data = personal_data;
|
|
121
|
-
const response = yield fetch(Settings.get_instance().get_host() + '/users', {
|
|
122
|
-
method: 'POST',
|
|
123
|
-
headers: headers,
|
|
124
|
-
body: JSON.stringify(body)
|
|
125
|
-
});
|
|
126
|
-
if (response.ok) { // User creation successful
|
|
127
|
-
const data = yield response.json();
|
|
128
|
-
this.connect(data.token, remember_token);
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
else { // User creation failed
|
|
132
|
-
console.error('User creation failed: ', response.statusText);
|
|
133
|
-
for (const listener of this.connection_listeners)
|
|
134
|
-
listener.connection_error(new Event(response.statusText));
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Logs out the user.
|
|
141
|
-
*/
|
|
142
|
-
logout() {
|
|
143
|
-
console.debug('Logging out user');
|
|
144
|
-
this.socket.send(JSON.stringify({ msg_type: 'logout' }));
|
|
145
|
-
this.token = null;
|
|
146
|
-
localStorage.removeItem('token');
|
|
147
|
-
for (const listener of this.connection_listeners) {
|
|
148
|
-
listener.logged_out();
|
|
149
|
-
}
|
|
150
|
-
this.socket.close();
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Checks whether the WebSocket connection is currently open.
|
|
154
|
-
*
|
|
155
|
-
* @returns {boolean} `true` if the socket exists and its ready state is `WebSocket.OPEN`, otherwise `false`.
|
|
156
|
-
*/
|
|
157
|
-
is_connected() { return this.socket !== null && this.socket.readyState === WebSocket.OPEN; }
|
|
158
|
-
/**
|
|
159
|
-
* Returns the current token.
|
|
160
|
-
*
|
|
161
|
-
* @returns {string | null} The current token, or `null` if not set.
|
|
162
|
-
*/
|
|
163
|
-
get_token() { return this.token; }
|
|
164
|
-
/**
|
|
165
|
-
* Adds a connection listener.
|
|
166
|
-
*
|
|
167
|
-
* @param listener Connection listener to add.
|
|
168
|
-
*/
|
|
169
|
-
add_connection_listener(listener) { this.connection_listeners.add(listener); }
|
|
170
|
-
/**
|
|
171
|
-
* Removes a connection listener.
|
|
172
|
-
*
|
|
173
|
-
* @param listener Connection listener to remove.
|
|
174
|
-
*/
|
|
175
|
-
remove_connection_listener(listener) { this.connection_listeners.delete(listener); }
|
|
176
|
-
}
|
|
177
|
-
//# sourceMappingURL=connection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/utils/connection.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,UAAU;IAOrB;QAJQ,WAAM,GAAqB,IAAI,CAAC;QAChC,yBAAoB,GAA4B,IAAI,GAAG,EAAE,CAAC;QAC1D,UAAK,GAAkB,IAAI,CAAC;QAGlC,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC;QAC/E,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,YAAY,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AAC;YAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAAC,CAAC;QAC5E,IAAI,CAAC,MAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,YAAY,KAAc,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAErG;;;;OAIG;IACH,SAAS,KAAoB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAEjD;;;;OAIG;IACH,uBAAuB,CAAC,QAA4B,IAAU,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExG;;;;OAIG;IACH,0BAA0B,CAAC,QAA4B,IAAU,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;CAC/G"}
|
package/dist/utils/selector.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manages a group of `Selector` instances, ensuring that only one selector is active (selected) at a time.
|
|
3
|
-
*
|
|
4
|
-
* The `SelectorGroup` class allows you to add or remove selectors, and provides a method to set a specific selector as selected.
|
|
5
|
-
* When a selector is set as selected, all other selectors in the group are automatically unselected.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* const group = new SelectorGroup();
|
|
9
|
-
* group.add_selector(selector1);
|
|
10
|
-
* group.add_selector(selector2);
|
|
11
|
-
* group.set_selected(selector1); // selector1 is selected, selector2 is unselected
|
|
12
|
-
*/
|
|
13
|
-
export declare class SelectorGroup {
|
|
14
|
-
private selectors;
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Sets the given selector as the selected one, unselecting all other selectors.
|
|
18
|
-
*
|
|
19
|
-
* Iterates through all selectors managed by this instance. For each selector that is not the one provided,
|
|
20
|
-
* it calls `unselect()`. Finally, it calls `select()` on the provided selector to mark it as selected.
|
|
21
|
-
*
|
|
22
|
-
* @param s - The {@link Selector} instance to be set as selected.
|
|
23
|
-
*/
|
|
24
|
-
set_selected(s: Selector): void;
|
|
25
|
-
/**
|
|
26
|
-
* Adds a selector to the current set of selectors.
|
|
27
|
-
*
|
|
28
|
-
* @param s - The selector to add.
|
|
29
|
-
*/
|
|
30
|
-
add_selector(s: Selector): void;
|
|
31
|
-
/**
|
|
32
|
-
* Removes the specified selector from the collection of selectors.
|
|
33
|
-
*
|
|
34
|
-
* @param s - The selector to be removed.
|
|
35
|
-
*/
|
|
36
|
-
remove_selector(s: Selector): void;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Represents an interface for selectable objects.
|
|
40
|
-
*
|
|
41
|
-
* Implementing classes should provide logic for selecting and unselecting themselves.
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
* This interface can be used to standardize selection behavior across different components or entities.
|
|
45
|
-
*
|
|
46
|
-
* @interface Selector
|
|
47
|
-
*/
|
|
48
|
-
export interface Selector {
|
|
49
|
-
/**
|
|
50
|
-
* Selects the object, marking it as active or highlighted.
|
|
51
|
-
* Implementing classes should define what "selecting" means for them.
|
|
52
|
-
*/
|
|
53
|
-
select(): void;
|
|
54
|
-
/**
|
|
55
|
-
* Unselects the object, marking it as inactive or unhighlighted.
|
|
56
|
-
* Implementing classes should define what "unselecting" means for them.
|
|
57
|
-
*/
|
|
58
|
-
unselect(): void;
|
|
59
|
-
}
|