@fluid-topics/ft-wc-utils 0.3.71 → 1.0.0-alpha.1
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/build/CacheRegistry.d.ts +1 -2
- package/build/CacheRegistry.js +0 -1
- package/build/CancelablePromise.d.ts +0 -1
- package/build/CancelablePromise.js +0 -1
- package/build/Debouncer.d.ts +0 -1
- package/build/Debouncer.js +0 -1
- package/build/FtCssVariables.d.ts +3 -4
- package/build/FtCssVariables.js +0 -1
- package/build/FtLitElement.d.ts +9 -17
- package/build/FtLitElement.js +21 -42
- package/build/ParametrizedLabelResolver.d.ts +1 -2
- package/build/ParametrizedLabelResolver.js +1 -2
- package/build/ScopedRegistryLitElement.d.ts +22 -0
- package/build/ScopedRegistryLitElement.js +23 -0
- package/build/decorators.d.ts +0 -1
- package/build/decorators.js +0 -1
- package/build/deep-equal.d.ts +0 -1
- package/build/deep-equal.js +0 -1
- package/build/delay.d.ts +0 -1
- package/build/delay.js +0 -1
- package/build/designSystemVariables.d.ts +0 -1
- package/build/designSystemVariables.js +0 -1
- package/build/events.d.ts +1 -2
- package/build/events.js +0 -1
- package/build/generic-types.d.ts +2 -2
- package/build/generic-types.js +0 -1
- package/build/globals.d.ts +0 -1
- package/build/globals.js +0 -1
- package/build/globals.min.js +23 -33
- package/build/index.d.ts +1 -2
- package/build/index.js +1 -1
- package/build/mixins.d.ts +0 -1
- package/build/mixins.js +0 -1
- package/build/redux.d.ts +16 -22
- package/build/redux.js +55 -90
- package/build/revivers.d.ts +0 -1
- package/build/revivers.js +0 -1
- package/build/rollup-globals.d.ts +0 -1
- package/build/rollup-globals.js +0 -1
- package/build/silent-define.d.ts +0 -1
- package/build/silent-define.js +0 -1
- package/build/silent-define.min.js +1 -1
- package/package.json +4 -5
package/build/redux.d.ts
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { FtLitElement } from "./FtLitElement";
|
|
2
2
|
import { Action, AnyAction, CaseReducerActions, CreateSliceOptions, Dispatch, Observable, Reducer, Slice, SliceCaseReducers, Store, Unsubscribe } from "@reduxjs/toolkit";
|
|
3
3
|
import { Optional } from "./generic-types";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { PropertyDeclaration } from "lit";
|
|
5
|
+
export type ReduxSelector<State, Element extends FtLitElementRedux> = (rootState: State, element: Element) => unknown;
|
|
6
|
+
interface ReduxProperty<State, Element extends FtLitElementRedux> {
|
|
7
7
|
store?: string;
|
|
8
|
+
selector: ReduxSelector<State, Element>;
|
|
8
9
|
}
|
|
9
|
-
export interface ReduxPropertyInit<
|
|
10
|
+
export interface ReduxPropertyInit<State, Element extends FtLitElementRedux> extends PropertyDeclaration {
|
|
10
11
|
store?: string;
|
|
11
|
-
selector?: ReduxSelector<
|
|
12
|
-
hasChanged?: (value: U, oldValue: U) => boolean;
|
|
13
|
-
attribute?: string | boolean;
|
|
12
|
+
selector?: ReduxSelector<State, Element>;
|
|
14
13
|
}
|
|
15
|
-
export declare const redux: <
|
|
14
|
+
export declare const redux: <State, Element_1 extends FtLitElementRedux>(propertyInit?: ReduxPropertyInit<State, Element_1> | undefined) => (proto: Object, name: string) => void;
|
|
15
|
+
declare const internalStoresUnsubscribers: unique symbol;
|
|
16
|
+
declare const internalStores: unique symbol;
|
|
16
17
|
export declare class FtLitElementRedux extends FtLitElement {
|
|
17
18
|
reduxProperties?: Map<string, ReduxProperty<unknown, FtLitElementRedux>>;
|
|
18
|
-
private readonly internalStoresUnsubscribers;
|
|
19
|
-
private readonly internalStores;
|
|
19
|
+
private readonly [internalStoresUnsubscribers];
|
|
20
|
+
private readonly [internalStores];
|
|
20
21
|
private getUnnamedStore;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
protected set store(store: Optional<Store>);
|
|
25
|
-
getStore<ReturnType = Optional<Store>>(name?: string): ReturnType;
|
|
26
|
-
protected addStore(store: Store, name?: string): void;
|
|
27
|
-
protected removeStore(storeOrName: Store | string): void;
|
|
22
|
+
getStore<ReturnType = Optional<FtReduxStore>>(name?: string): ReturnType;
|
|
23
|
+
protected addStore(store: FtReduxStore, name?: string): void;
|
|
24
|
+
protected removeStore(storeOrName: FtReduxStore | string): void;
|
|
28
25
|
private setupStore;
|
|
29
26
|
private setupStores;
|
|
30
27
|
private updateFromStores;
|
|
@@ -52,16 +49,13 @@ export declare class FtReduxStore<State = any, CR extends SliceCaseReducers<Stat
|
|
|
52
49
|
getState(): State;
|
|
53
50
|
replaceReducer(nextReducer: Reducer<State, A>): void;
|
|
54
51
|
subscribe(listener: () => void): Unsubscribe;
|
|
55
|
-
actions: CaseReducerActions<CR>;
|
|
52
|
+
actions: CaseReducerActions<CR, string>;
|
|
56
53
|
get name(): string;
|
|
57
|
-
get reducer(): Reducer<State
|
|
54
|
+
get reducer(): Reducer<State>;
|
|
58
55
|
get caseReducers(): { [Type in keyof CR]: CR[Type] extends {
|
|
59
56
|
reducer: infer Reducer_1;
|
|
60
57
|
} ? Reducer_1 : CR[Type]; };
|
|
61
58
|
getInitialState(): State;
|
|
62
59
|
}
|
|
63
|
-
/**@deprecated Use FtReduxStore.get instead*/
|
|
64
|
-
export declare function getStore(slice: Slice, name?: string): Store;
|
|
65
60
|
export declare function clearAllStores(): void;
|
|
66
61
|
export {};
|
|
67
|
-
//# sourceMappingURL=redux.d.ts.map
|
package/build/redux.js
CHANGED
|
@@ -1,84 +1,64 @@
|
|
|
1
|
+
var _a, _b;
|
|
1
2
|
import { FtLitElement } from "./FtLitElement";
|
|
2
3
|
import { configureStore, createSlice } from "@reduxjs/toolkit";
|
|
3
4
|
import { deepEqual } from "./deep-equal";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|| o.selector != null
|
|
8
|
-
|| typeof o.hasChanged === "function"
|
|
9
|
-
|| o.attribute != null);
|
|
10
|
-
};
|
|
11
|
-
export const redux = (// TODO next major version: Remove compat
|
|
12
|
-
selectorOrInit, hasChanged) => {
|
|
13
|
-
var _a;
|
|
14
|
-
const init = isReduxPropertyInit(selectorOrInit) ? selectorOrInit : {};
|
|
15
|
-
hasChanged = (_a = hasChanged !== null && hasChanged !== void 0 ? hasChanged : init.hasChanged) !== null && _a !== void 0 ? _a : ((a, b) => !deepEqual(a, b));
|
|
5
|
+
import { property } from "lit/decorators.js";
|
|
6
|
+
export const redux = (propertyInit) => {
|
|
7
|
+
const init = propertyInit !== null && propertyInit !== void 0 ? propertyInit : {};
|
|
16
8
|
return (proto, name) => {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
hasChanged,
|
|
20
|
-
attribute:
|
|
21
|
-
|
|
9
|
+
var _c;
|
|
10
|
+
const litPropertyInit = {
|
|
11
|
+
hasChanged: ((a, b) => !deepEqual(a, b)),
|
|
12
|
+
attribute: false,
|
|
13
|
+
...init
|
|
14
|
+
};
|
|
15
|
+
property(litPropertyInit)(proto, name);
|
|
22
16
|
const reduxProto = proto;
|
|
23
17
|
reduxProto.reduxProperties = reduxProto.reduxProperties || new Map();
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
reduxProto.reduxProperties.set(name, {
|
|
19
|
+
selector: (_c = init.selector) !== null && _c !== void 0 ? _c : ((s) => s[name]),
|
|
20
|
+
store: init.store
|
|
21
|
+
});
|
|
26
22
|
};
|
|
27
23
|
};
|
|
24
|
+
const internalStoresUnsubscribers = Symbol("internalStoresUnsubscribers");
|
|
25
|
+
const internalStores = Symbol("internalStores");
|
|
28
26
|
export class FtLitElementRedux extends FtLitElement {
|
|
29
27
|
constructor() {
|
|
30
28
|
super(...arguments);
|
|
31
|
-
this
|
|
32
|
-
this
|
|
29
|
+
this[_a] = new Map();
|
|
30
|
+
this[_b] = new Map();
|
|
33
31
|
}
|
|
34
32
|
getUnnamedStore() {
|
|
35
|
-
if (this
|
|
33
|
+
if (this[internalStores].size > 1) {
|
|
36
34
|
throw new Error("Cannot resolve unnamed store when multiple stores are configured.");
|
|
37
35
|
}
|
|
38
|
-
return [...this
|
|
39
|
-
}
|
|
40
|
-
/**@deprecated*/
|
|
41
|
-
get store() {
|
|
42
|
-
return this.getUnnamedStore(); // Compatibility with use of setter and getter without override TODO next major version: Remove compat
|
|
43
|
-
}
|
|
44
|
-
/**@deprecated*/
|
|
45
|
-
set store(store) {
|
|
46
|
-
this.unsubscribeFromStores();
|
|
47
|
-
this.internalStores.clear();
|
|
48
|
-
if (store) {
|
|
49
|
-
this.addStore(store);
|
|
50
|
-
}
|
|
36
|
+
return [...this[internalStores].values()][0];
|
|
51
37
|
}
|
|
52
38
|
getStore(name) {
|
|
53
|
-
var _a;
|
|
54
39
|
return (name == null
|
|
55
|
-
?
|
|
56
|
-
: this
|
|
40
|
+
? this.getUnnamedStore()
|
|
41
|
+
: this[internalStores].get(name));
|
|
57
42
|
}
|
|
58
43
|
addStore(store, name) {
|
|
59
|
-
name = name !== null && name !== void 0 ? name :
|
|
44
|
+
name = name !== null && name !== void 0 ? name : store.name;
|
|
60
45
|
this.unsubscribeFromStore(name);
|
|
61
46
|
this.setupStore(name, store);
|
|
62
47
|
}
|
|
63
48
|
removeStore(storeOrName) {
|
|
64
|
-
const name = typeof storeOrName === "string" ? storeOrName :
|
|
49
|
+
const name = typeof storeOrName === "string" ? storeOrName : storeOrName.name;
|
|
65
50
|
this.unsubscribeFromStore(name);
|
|
66
|
-
this
|
|
51
|
+
this[internalStores].delete(name);
|
|
67
52
|
}
|
|
68
53
|
setupStore(name, store) {
|
|
69
|
-
this
|
|
70
|
-
this.updateFromStores();
|
|
54
|
+
this[internalStores].set(name, store);
|
|
71
55
|
this.subscribeToStore(name, store);
|
|
56
|
+
this.updateFromStores();
|
|
72
57
|
}
|
|
73
58
|
setupStores() {
|
|
74
59
|
this.unsubscribeFromStores();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.updateFromStores();
|
|
80
|
-
this.internalStores.forEach((store, name) => this.subscribeToStore(name, store));
|
|
81
|
-
}
|
|
60
|
+
this[internalStores].forEach((store, name) => this.subscribeToStore(name, store));
|
|
61
|
+
this.updateFromStores();
|
|
82
62
|
}
|
|
83
63
|
updateFromStores() {
|
|
84
64
|
if (this.reduxProperties) {
|
|
@@ -94,17 +74,17 @@ export class FtLitElementRedux extends FtLitElement {
|
|
|
94
74
|
}
|
|
95
75
|
}
|
|
96
76
|
subscribeToStore(name, store) {
|
|
97
|
-
this
|
|
77
|
+
this[internalStoresUnsubscribers].set(name, store.subscribe(() => this.updateFromStores()));
|
|
98
78
|
this.onStoreAvailable(name);
|
|
99
79
|
}
|
|
100
80
|
unsubscribeFromStores() {
|
|
101
|
-
Object.keys(this
|
|
81
|
+
Object.keys(this[internalStoresUnsubscribers]).forEach(key => this.unsubscribeFromStore(key));
|
|
102
82
|
}
|
|
103
83
|
unsubscribeFromStore(name) {
|
|
104
|
-
if (this
|
|
105
|
-
this
|
|
84
|
+
if (this[internalStoresUnsubscribers].has(name)) {
|
|
85
|
+
this[internalStoresUnsubscribers].get(name)();
|
|
106
86
|
}
|
|
107
|
-
this
|
|
87
|
+
this[internalStoresUnsubscribers].delete(name);
|
|
108
88
|
}
|
|
109
89
|
onStoreAvailable(name) {
|
|
110
90
|
}
|
|
@@ -117,11 +97,29 @@ export class FtLitElementRedux extends FtLitElement {
|
|
|
117
97
|
super.disconnectedCallback();
|
|
118
98
|
}
|
|
119
99
|
}
|
|
100
|
+
_a = internalStoresUnsubscribers, _b = internalStores;
|
|
120
101
|
function isFtReduxStore(o) {
|
|
121
|
-
var
|
|
122
|
-
return (
|
|
102
|
+
var _c;
|
|
103
|
+
return (_c = o === null || o === void 0 ? void 0 : o.isFtReduxStore) !== null && _c !== void 0 ? _c : false;
|
|
123
104
|
}
|
|
124
105
|
export class FtReduxStore {
|
|
106
|
+
static get(nameOrOptions) {
|
|
107
|
+
if (!window.ftReduxStores) {
|
|
108
|
+
window.ftReduxStores = {};
|
|
109
|
+
}
|
|
110
|
+
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
111
|
+
const options = typeof nameOrOptions === "string" ? undefined : nameOrOptions;
|
|
112
|
+
const maybeExistingStore = window.ftReduxStores[name];
|
|
113
|
+
if (isFtReduxStore(maybeExistingStore)) {
|
|
114
|
+
return maybeExistingStore;
|
|
115
|
+
}
|
|
116
|
+
if (options == null) {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const reduxSlice = createSlice(options);
|
|
120
|
+
const reduxStore = configureStore({ reducer: reduxSlice.reducer });
|
|
121
|
+
return window.ftReduxStores[options.name] = new FtReduxStore(reduxSlice, reduxStore);
|
|
122
|
+
}
|
|
125
123
|
constructor(reduxSlice, reduxStore) {
|
|
126
124
|
this.reduxSlice = reduxSlice;
|
|
127
125
|
this.reduxStore = reduxStore;
|
|
@@ -141,26 +139,6 @@ export class FtReduxStore {
|
|
|
141
139
|
}
|
|
142
140
|
});
|
|
143
141
|
}
|
|
144
|
-
static get(nameOrOptions) {
|
|
145
|
-
if (!window.ftReduxStores) {
|
|
146
|
-
window.ftReduxStores = {};
|
|
147
|
-
}
|
|
148
|
-
const name = typeof nameOrOptions === "string" ? nameOrOptions : nameOrOptions.name;
|
|
149
|
-
const options = typeof nameOrOptions === "string" ? undefined : nameOrOptions;
|
|
150
|
-
const maybeExistingStore = window.ftReduxStores[name];
|
|
151
|
-
if (isFtReduxStore(maybeExistingStore)) {
|
|
152
|
-
return maybeExistingStore;
|
|
153
|
-
}
|
|
154
|
-
if (options == null) {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
const reduxSlice = createSlice(options);
|
|
158
|
-
if (maybeExistingStore) { // TODO next major version: Remove compat
|
|
159
|
-
return new FtReduxStore(reduxSlice, maybeExistingStore);
|
|
160
|
-
}
|
|
161
|
-
const reduxStore = configureStore({ reducer: reduxSlice.reducer });
|
|
162
|
-
return window.ftReduxStores[options.name] = new FtReduxStore(reduxSlice, reduxStore);
|
|
163
|
-
}
|
|
164
142
|
// Implement Store
|
|
165
143
|
get dispatch() {
|
|
166
144
|
throw new Error("Don't use this method, actions are automatically dispatched when called.");
|
|
@@ -190,19 +168,6 @@ export class FtReduxStore {
|
|
|
190
168
|
return this.reduxSlice.getInitialState();
|
|
191
169
|
}
|
|
192
170
|
}
|
|
193
|
-
// TODO next major version: Remove this
|
|
194
|
-
/**@deprecated Use FtReduxStore.get instead*/
|
|
195
|
-
export function getStore(slice, name) {
|
|
196
|
-
if (!window.ftReduxStores) {
|
|
197
|
-
window.ftReduxStores = {};
|
|
198
|
-
}
|
|
199
|
-
const storeName = name || slice.name;
|
|
200
|
-
if (!window.ftReduxStores[storeName]) {
|
|
201
|
-
window.ftReduxStores[storeName] = configureStore({ reducer: slice.reducer });
|
|
202
|
-
}
|
|
203
|
-
return window.ftReduxStores[storeName];
|
|
204
|
-
}
|
|
205
171
|
export function clearAllStores() {
|
|
206
172
|
window.ftReduxStores = {};
|
|
207
173
|
}
|
|
208
|
-
//# sourceMappingURL=redux.js.map
|
package/build/revivers.d.ts
CHANGED
package/build/revivers.js
CHANGED
package/build/rollup-globals.js
CHANGED
package/build/silent-define.d.ts
CHANGED
package/build/silent-define.js
CHANGED
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @see https://github.com/webcomponents/polyfills/tree/master/packages/scoped-custom-element-registry
|
|
16
16
|
*/
|
|
17
|
-
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.customElements.define,n=window.customElements.get,s=window.customElements,o=new WeakMap,i=new WeakMap,c=new WeakMap,r=new WeakMap;let a;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,o){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(o))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const r=o.prototype.attributeChangedCallback,a=new Set(o.observedAttributes||[]);w(o,a,r);const l={elementClass:o,connectedCallback:o.prototype.connectedCallback,disconnectedCallback:o.prototype.disconnectedCallback,adoptedCallback:o.prototype.adoptedCallback,attributeChangedCallback:r,formAssociated:o.formAssociated,formAssociatedCallback:o.prototype.formAssociatedCallback,formDisabledCallback:o.prototype.formDisabledCallback,formResetCallback:o.prototype.formResetCallback,formStateRestoreCallback:o.prototype.formStateRestoreCallback,observedAttributes:a};this._definitionsByTag.set(t,l),this._definitionsByClass.set(o,l);let h=n.call(s,t);h||(h=d(t),e.call(s,t,h)),this===window.customElements&&(c.set(o,l),l.standInClass=h);const u=this._awaitingUpgrade.get(t);if(u){this._awaitingUpgrade.delete(t);for(const t of u)i.delete(t),m(t,l,!0)}const f=this._whenDefinedPromises.get(t);return void 0!==f&&(f.resolve(o),this._whenDefinedPromises.delete(t)),o}upgrade(){b.push(this),s.upgrade.apply(s,arguments),b.pop()}get(t){
|
|
17
|
+
if(!ShadowRoot.prototype.createElement){const t=window.HTMLElement,e=window.customElements.define,n=window.customElements.get,s=window.customElements,o=new WeakMap,i=new WeakMap,c=new WeakMap,r=new WeakMap;let a;window.CustomElementRegistry=class{constructor(){this._definitionsByTag=new Map,this._definitionsByClass=new Map,this._whenDefinedPromises=new Map,this._awaitingUpgrade=new Map}define(t,o){if(t=t.toLowerCase(),void 0!==this._getDefinition(t))throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(void 0!==this._definitionsByClass.get(o))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");const r=o.prototype.attributeChangedCallback,a=new Set(o.observedAttributes||[]);w(o,a,r);const l={elementClass:o,connectedCallback:o.prototype.connectedCallback,disconnectedCallback:o.prototype.disconnectedCallback,adoptedCallback:o.prototype.adoptedCallback,attributeChangedCallback:r,formAssociated:o.formAssociated,formAssociatedCallback:o.prototype.formAssociatedCallback,formDisabledCallback:o.prototype.formDisabledCallback,formResetCallback:o.prototype.formResetCallback,formStateRestoreCallback:o.prototype.formStateRestoreCallback,observedAttributes:a};this._definitionsByTag.set(t,l),this._definitionsByClass.set(o,l);let h=n.call(s,t);h||(h=d(t),e.call(s,t,h)),this===window.customElements&&(c.set(o,l),l.standInClass=h);const u=this._awaitingUpgrade.get(t);if(u){this._awaitingUpgrade.delete(t);for(const t of u)i.delete(t),m(t,l,!0)}const f=this._whenDefinedPromises.get(t);return void 0!==f&&(f.resolve(o),this._whenDefinedPromises.delete(t)),o}upgrade(){b.push(this),s.upgrade.apply(s,arguments),b.pop()}get(t){const e=this._definitionsByTag.get(t);return e?.elementClass}_getDefinition(t){return this._definitionsByTag.get(t)}whenDefined(t){const e=this._getDefinition(t);if(void 0!==e)return Promise.resolve(e.elementClass);let n=this._whenDefinedPromises.get(t);return void 0===n&&(n={},n.promise=new Promise((t=>n.resolve=t)),this._whenDefinedPromises.set(t,n)),n.promise}_upgradeWhenDefined(t,e,n){let s=this._awaitingUpgrade.get(e);s||this._awaitingUpgrade.set(e,s=new Set),n?s.add(t):s.delete(t)}},window.HTMLElement=function(){let e=a;if(e)return a=void 0,e;const n=c.get(this.constructor);if(!n)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return e=Reflect.construct(t,[],n.standInClass),Object.setPrototypeOf(e,this.constructor.prototype),o.set(e,n),e},window.HTMLElement.prototype=t.prototype;const l=t=>t===document||t instanceof ShadowRoot,h=t=>{let e=t.getRootNode();if(!l(e)){const t=b[b.length-1];if(t instanceof CustomElementRegistry)return t;e=t.getRootNode(),l(e)||(e=r.get(e)?.getRootNode()||document)}return e.customElements},d=e=>class{static get formAssociated(){return!0}constructor(){const n=Reflect.construct(t,[],this.constructor);Object.setPrototypeOf(n,HTMLElement.prototype);const s=h(n)||window.customElements,o=s._getDefinition(e);return o?m(n,o):i.set(n,s),n}connectedCallback(){const t=o.get(this);t?t.connectedCallback&&t.connectedCallback.apply(this,arguments):i.get(this)._upgradeWhenDefined(this,e,!0)}disconnectedCallback(){const t=o.get(this);t?t.disconnectedCallback&&t.disconnectedCallback.apply(this,arguments):i.get(this)._upgradeWhenDefined(this,e,!1)}adoptedCallback(){const t=o.get(this);t?.adoptedCallback?.apply(this,arguments)}formAssociatedCallback(){const t=o.get(this);t&&t.formAssociated&&t?.formAssociatedCallback?.apply(this,arguments)}formDisabledCallback(){const t=o.get(this);t?.formAssociated&&t?.formDisabledCallback?.apply(this,arguments)}formResetCallback(){const t=o.get(this);t?.formAssociated&&t?.formResetCallback?.apply(this,arguments)}formStateRestoreCallback(){const t=o.get(this);t?.formAssociated&&t?.formStateRestoreCallback?.apply(this,arguments)}},w=(t,e,n)=>{if(0===e.size||void 0===n)return;const s=t.prototype.setAttribute;s&&(t.prototype.setAttribute=function(t,o){const i=t.toLowerCase();if(e.has(i)){const t=this.getAttribute(i);s.call(this,i,o),n.call(this,i,t,o)}else s.call(this,i,o)});const o=t.prototype.removeAttribute;o&&(t.prototype.removeAttribute=function(t){const s=t.toLowerCase();if(e.has(s)){const t=this.getAttribute(s);o.call(this,s),n.call(this,s,t,null)}else o.call(this,s)})},u=e=>{const n=Object.getPrototypeOf(e);if(n!==window.HTMLElement)return n===t||"HTMLElement"===n?.prototype?.constructor?.name?Object.setPrototypeOf(e,window.HTMLElement):u(n)},m=(t,e,n=!1)=>{Object.setPrototypeOf(t,e.elementClass.prototype),o.set(t,e),a=t;try{new e.elementClass}catch(t){u(e.elementClass),new e.elementClass}e.observedAttributes.forEach((n=>{t.hasAttribute(n)&&e.attributeChangedCallback.call(t,n,null,t.getAttribute(n))})),n&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)},f=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){const e=f.apply(this,arguments);return t.customElements&&(e.customElements=t.customElements),e};let b=[document];const E=(t,e,n=void 0)=>{const s=(n?Object.getPrototypeOf(n):t.prototype)[e];t.prototype[e]=function(){b.push(this);const t=s.apply(n||this,arguments);return void 0!==t&&r.set(t,this),b.pop(),t}};E(ShadowRoot,"createElement",document),E(ShadowRoot,"importNode",document),E(Element,"insertAdjacentHTML");const M=(t,e)=>{const n=Object.getOwnPropertyDescriptor(t.prototype,e);Object.defineProperty(t.prototype,e,{...n,set(t){b.push(this),n.set.call(this,t),b.pop()}})};if(M(Element,"innerHTML"),M(ShadowRoot,"innerHTML"),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){const t=new WeakMap,e=HTMLElement.prototype.attachInternals,n=["setFormValue","setValidity","checkValidity","reportValidity"];HTMLElement.prototype.attachInternals=function(...n){const s=e.call(this,...n);return t.set(s,this),s},n.forEach((e=>{const n=window.ElementInternals.prototype,s=n[e];n[e]=function(...e){const n=t.get(this);if(!0!==o.get(n).formAssociated)throw new DOMException(`Failed to execute ${s} on 'ElementInternals': The target element is not a form-associated custom element.`);s?.call(this,...e)}}));class s extends Array{constructor(t){super(...t),this._elements=t}get value(){return this._elements.find((t=>!0===t.checked))?.value||""}}class i{constructor(t){const e=new Map;t.forEach(((t,n)=>{const s=t.getAttribute("name"),o=e.get(s)||[];this[+n]=t,o.push(t),e.set(s,o)})),this.length=t.length,e.forEach(((t,e)=>{t&&(1===t.length?this[e]=t[0]:this[e]=new s(t))}))}namedItem(t){return this[t]}}const c=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){const t=c.get.call(this,[]),e=[];for(const n of t){const t=o.get(n);t&&!0!==t.formAssociated||e.push(n)}return new i(e)}})}}try{window.customElements.define("custom-element",null)}catch(t){const e=window.customElements.define;window.customElements.define=(t,n,s)=>{try{e.bind(window.customElements)(t,n,s)}catch(e){console.info(t,n,s,e)}}}}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-wc-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "Internal web components tools",
|
|
5
5
|
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
"lib/*"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"
|
|
18
|
-
"lit": "2.2.8"
|
|
16
|
+
"@reduxjs/toolkit": "1.9.5",
|
|
17
|
+
"lit": "2.7.2"
|
|
19
18
|
},
|
|
20
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "bb54c217f788a915a443db6f496f02e176d05306"
|
|
21
20
|
}
|