@fluid-topics/ft-wc-utils 0.0.88
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/Debouncer.d.ts +12 -0
- package/build/Debouncer.js +30 -0
- package/build/FtLitElement.d.ts +16 -0
- package/build/FtLitElement.js +39 -0
- package/build/ParametrizedLabelResolver.d.ts +8 -0
- package/build/ParametrizedLabelResolver.js +13 -0
- package/build/decorators.d.ts +5 -0
- package/build/decorators.js +30 -0
- package/build/index.d.ts +9 -0
- package/build/index.js +11 -0
- package/build/redux.d.ts +19 -0
- package/build/redux.js +50 -0
- package/build/silent-define.d.ts +2 -0
- package/build/silent-define.js +18 -0
- package/build/silent-define.min.js +1 -0
- package/build/storybook.d.ts +12 -0
- package/build/storybook.js +23 -0
- package/package.json +22 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class Debouncer {
|
|
2
|
+
private timeout;
|
|
3
|
+
private _debounce?;
|
|
4
|
+
private callbacks;
|
|
5
|
+
constructor(timeout?: number);
|
|
6
|
+
run(callback: Function, timeout?: number): void;
|
|
7
|
+
queue(callback: Function, timeout?: number): void;
|
|
8
|
+
cancel(): void;
|
|
9
|
+
private debounce;
|
|
10
|
+
private runCallbacks;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Debouncer.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class Debouncer {
|
|
2
|
+
constructor(timeout = 0) {
|
|
3
|
+
this.timeout = timeout;
|
|
4
|
+
this.callbacks = [];
|
|
5
|
+
}
|
|
6
|
+
run(callback, timeout) {
|
|
7
|
+
this.callbacks = [callback];
|
|
8
|
+
this.debounce(timeout);
|
|
9
|
+
}
|
|
10
|
+
queue(callback, timeout) {
|
|
11
|
+
this.callbacks.push(callback);
|
|
12
|
+
this.debounce(timeout);
|
|
13
|
+
}
|
|
14
|
+
cancel() {
|
|
15
|
+
if (this._debounce != null) {
|
|
16
|
+
window.clearTimeout(this._debounce);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
debounce(timeout) {
|
|
20
|
+
this.cancel();
|
|
21
|
+
this._debounce = window.setTimeout(() => this.runCallbacks(), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
22
|
+
}
|
|
23
|
+
runCallbacks() {
|
|
24
|
+
for (let callback of this.callbacks) {
|
|
25
|
+
callback();
|
|
26
|
+
}
|
|
27
|
+
this.callbacks = [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Debouncer.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { CSSResultGroup } from "@lit/reactive-element/css-tag";
|
|
3
|
+
export { ElementDefinitionsMap } from "@lit-labs/scoped-registry-mixin";
|
|
4
|
+
declare const FtLitElement_base: typeof LitElement;
|
|
5
|
+
export declare class FtLitElement extends FtLitElement_base {
|
|
6
|
+
private readonly proto;
|
|
7
|
+
private readonly constructorName;
|
|
8
|
+
constructor();
|
|
9
|
+
protected getStyles(): CSSResultGroup;
|
|
10
|
+
protected getTemplate(): unknown;
|
|
11
|
+
protected render(): unknown;
|
|
12
|
+
adoptedCallback(): void;
|
|
13
|
+
protected updated(props: PropertyValues): void;
|
|
14
|
+
protected contentAvailableCallback(props: PropertyValues): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=FtLitElement.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { html, LitElement } from "lit";
|
|
2
|
+
import { ScopedRegistryHost } from "@lit-labs/scoped-registry-mixin";
|
|
3
|
+
export class FtLitElement extends ScopedRegistryHost(LitElement) {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.constructorName = this.constructor.name;
|
|
7
|
+
this.proto = this.constructor.prototype;
|
|
8
|
+
}
|
|
9
|
+
getStyles() {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
getTemplate() {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
let styles = this.getStyles();
|
|
17
|
+
if (!Array.isArray(styles)) {
|
|
18
|
+
styles = [styles];
|
|
19
|
+
}
|
|
20
|
+
return html `
|
|
21
|
+
${styles.map(s => html `
|
|
22
|
+
<style>${s}</style>
|
|
23
|
+
`)}
|
|
24
|
+
${this.getTemplate()}
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
adoptedCallback() {
|
|
28
|
+
if (Object.getPrototypeOf(this) !== this.constructorName) {
|
|
29
|
+
Object.setPrototypeOf(this, this.proto);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
updated(props) {
|
|
33
|
+
super.updated(props);
|
|
34
|
+
setTimeout(() => this.contentAvailableCallback(props), 0);
|
|
35
|
+
}
|
|
36
|
+
contentAvailableCallback(props) {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=FtLitElement.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type ParametrizedLabels = Record<string, string | undefined>;
|
|
2
|
+
export declare class ParametrizedLabelResolver<T extends ParametrizedLabels> {
|
|
3
|
+
private defaultLabels;
|
|
4
|
+
private labels;
|
|
5
|
+
constructor(defaultLabels: T, labels: T);
|
|
6
|
+
resolve(key: keyof T, ...args: any[]): string | NonNullable<T[keyof T]>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=ParametrizedLabelResolver.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ParametrizedLabelResolver {
|
|
2
|
+
constructor(defaultLabels, labels) {
|
|
3
|
+
this.defaultLabels = defaultLabels;
|
|
4
|
+
this.labels = labels;
|
|
5
|
+
}
|
|
6
|
+
resolve(key, ...args) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
let label = (_b = (_a = this.labels[key]) !== null && _a !== void 0 ? _a : this.defaultLabels[key]) !== null && _b !== void 0 ? _b : "";
|
|
9
|
+
args.forEach((value, index) => label = label.replace(new RegExp(`\\{${index}\\}`, "g"), value));
|
|
10
|
+
return label;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ParametrizedLabelResolver.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropertyDeclaration } from "@lit/reactive-element";
|
|
2
|
+
import { ClassElement } from "@lit/reactive-element/decorators/base";
|
|
3
|
+
export declare const customElement: (tagName: string) => (clazz: CustomElementConstructor) => void;
|
|
4
|
+
export declare function jsonProperty(defaultValue: any, options?: PropertyDeclaration): (attribute: Object | ClassElement, name?: PropertyKey | undefined) => any;
|
|
5
|
+
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { property } from "lit/decorators.js";
|
|
2
|
+
export const customElement = (tagName) => (clazz) => {
|
|
3
|
+
if (!window.customElements.get(tagName)) {
|
|
4
|
+
window.customElements.define(tagName, clazz);
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
export function jsonProperty(defaultValue, options) {
|
|
8
|
+
const fallback = () => JSON.parse(JSON.stringify(defaultValue));
|
|
9
|
+
return property({
|
|
10
|
+
type: Object,
|
|
11
|
+
converter: {
|
|
12
|
+
fromAttribute: (value) => {
|
|
13
|
+
if (value == null) {
|
|
14
|
+
return fallback();
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(value);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return fallback();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
toAttribute: (value) => {
|
|
24
|
+
return JSON.stringify(value);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
...(options !== null && options !== void 0 ? options : {})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=decorators.js.map
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./silent-define";
|
|
2
|
+
export declare const isSafari: boolean;
|
|
3
|
+
export * from "./Debouncer";
|
|
4
|
+
export * from "./decorators";
|
|
5
|
+
export * from "./FtLitElement";
|
|
6
|
+
export * from "./storybook";
|
|
7
|
+
export * from "./redux";
|
|
8
|
+
export * from "./ParametrizedLabelResolver";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/build/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var _a, _b, _c;
|
|
2
|
+
import "./silent-define";
|
|
3
|
+
export const isSafari = (navigator.vendor && !!navigator.vendor.match(/apple/i))
|
|
4
|
+
|| ((_c = (_b = (_a = window.safari) === null || _a === void 0 ? void 0 : _a.pushNotification) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "") === "[object SafariRemoteNotification]";
|
|
5
|
+
export * from "./Debouncer";
|
|
6
|
+
export * from "./decorators";
|
|
7
|
+
export * from "./FtLitElement";
|
|
8
|
+
export * from "./storybook";
|
|
9
|
+
export * from "./redux";
|
|
10
|
+
export * from "./ParametrizedLabelResolver";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/build/redux.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FtLitElement } from "./FtLitElement";
|
|
2
|
+
import { Slice, Store } from "@reduxjs/toolkit";
|
|
3
|
+
export declare type ReduxSelector<T> = (rootState: T) => unknown;
|
|
4
|
+
export declare const redux: <T, U = unknown>(selector: ReduxSelector<T>, hasChanged?: ((value: U, oldValue: U) => boolean) | undefined) => (proto: Object, name: string) => void;
|
|
5
|
+
export declare abstract class FtLitElementRedux extends FtLitElement {
|
|
6
|
+
reduxProperties?: Map<string, ReduxSelector<unknown>>;
|
|
7
|
+
private unsubscribeFromStore;
|
|
8
|
+
abstract get store(): any;
|
|
9
|
+
private updateFromStore;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
reduxStores?: Record<string, Store>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export declare function getStore(slice: Slice): Store;
|
|
19
|
+
//# sourceMappingURL=redux.d.ts.map
|
package/build/redux.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FtLitElement } from "./FtLitElement";
|
|
2
|
+
import { configureStore } from "@reduxjs/toolkit";
|
|
3
|
+
export const redux = (selector, hasChanged) => {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5
|
+
return (proto, name) => {
|
|
6
|
+
proto.constructor.createProperty(name, {
|
|
7
|
+
attribute: false,
|
|
8
|
+
hasChanged,
|
|
9
|
+
});
|
|
10
|
+
const reduxProto = proto;
|
|
11
|
+
reduxProto.reduxProperties = reduxProto.reduxProperties || new Map();
|
|
12
|
+
reduxProto.reduxProperties.set(name, selector);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export class FtLitElementRedux extends FtLitElement {
|
|
16
|
+
updateFromStore() {
|
|
17
|
+
const rootState = this.store.getState();
|
|
18
|
+
if (this.reduxProperties) {
|
|
19
|
+
this.reduxProperties.forEach((selector, reduxProperty) => {
|
|
20
|
+
this[reduxProperty] = selector(rootState);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this.updateFromStore();
|
|
27
|
+
this.unsubscribeFromStore = this.store.subscribe(() => {
|
|
28
|
+
this.updateFromStore();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
if (this.unsubscribeFromStore) {
|
|
33
|
+
this.unsubscribeFromStore();
|
|
34
|
+
}
|
|
35
|
+
super.disconnectedCallback();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function getStore(slice) {
|
|
39
|
+
if (!window.reduxStores) {
|
|
40
|
+
window.reduxStores = {};
|
|
41
|
+
}
|
|
42
|
+
const name = slice.name;
|
|
43
|
+
if (!window.reduxStores[name]) {
|
|
44
|
+
window.reduxStores[name] = configureStore({
|
|
45
|
+
reducer: slice.reducer
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return window.reduxStores[name];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=redux.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "@webcomponents/scoped-custom-element-registry";
|
|
2
|
+
try {
|
|
3
|
+
// Throws expected error to replace default window.customElements.define
|
|
4
|
+
//@ts-ignore
|
|
5
|
+
window.customElements.define("custom-element", null);
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
const initialDefine = window.customElements.define;
|
|
9
|
+
window.customElements.define = (name, constructor, options) => {
|
|
10
|
+
try {
|
|
11
|
+
initialDefine.bind(window.customElements)(name, constructor, options);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
console.warn(name, constructor, options, e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=silent-define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){(function(){function t(t){var n=0;return function(){return n<t.length?{done:!1,value:t[n++]}:{done:!0}}}function n(n){var e="undefined"!=typeof Symbol&&Symbol.iterator&&n[Symbol.iterator];return e?e.call(n):{next:t(n)}}function e(t){if(!(t instanceof Array)){t=n(t);for(var e,i=[];!(e=t.next()).done;)i.push(e.value);t=i}return t}var i="function"==typeof Object.create?Object.create:function(t){function n(){}return n.prototype=t,new n};var o,r=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var n=0;n<t.length;++n){var e=t[n];if(e&&e.Math==Math)return e}throw Error("Cannot find global object")}(this),a=function(){if("undefined"!=typeof Reflect&&Reflect.construct){if(function(){function t(){}return Reflect.construct(t,[],(function(){})),new t instanceof t}())return Reflect.construct;var t=Reflect.construct;return function(n,e,i){return n=t(n,e),i&&Reflect.setPrototypeOf(n,i.prototype),n}}return function(t,n,e){return void 0===e&&(e=t),e=i(e.prototype||Object.prototype),Function.prototype.apply.call(t,e,n)||e}}();if("function"==typeof Object.setPrototypeOf)o=Object.setPrototypeOf;else{var c;t:{var u={};try{u.__proto__={a:!0},c=u.a;break t}catch(t){}c=!1}o=c?function(t,n){if(t.__proto__=n,t.__proto__!==n)throw new TypeError(t+" is not extensible");return t}:null}var s=o;if(!ShadowRoot.prototype.createElement){var l,f=window.HTMLElement,h=window.customElements.define,w=window.customElements.get,d=window.customElements,v=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap;window.CustomElementRegistry=function(){this.l=new Map,this.o=new Map,this.i=new Map,this.h=new Map},window.CustomElementRegistry.prototype.define=function(t,e){if(t=t.toLowerCase(),void 0!==this.j(t))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \""+t+'" has already been used with this registry');if(void 0!==this.o.get(e))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");var i=e.prototype.attributeChangedCallback,o=new Set(e.observedAttributes||[]);if(j(e,o,i),i={g:e,connectedCallback:e.prototype.connectedCallback,disconnectedCallback:e.prototype.disconnectedCallback,adoptedCallback:e.prototype.adoptedCallback,attributeChangedCallback:i,formAssociated:e.formAssociated,formAssociatedCallback:e.prototype.formAssociatedCallback,formDisabledCallback:e.prototype.formDisabledCallback,formResetCallback:e.prototype.formResetCallback,formStateRestoreCallback:e.prototype.formStateRestoreCallback,observedAttributes:o},this.l.set(t,i),this.o.set(e,i),(o=w.call(d,t))||(o=p(t),h.call(d,t,o)),this===window.customElements&&(m.set(e,i),i.s=o),o=this.h.get(t)){this.h.delete(t);for(var r=(o=n(o)).next();!r.done;r=o.next())r=r.value,b.delete(r),E(r,i,!0)}return void 0!==(i=this.i.get(t))&&(i.resolve(e),this.i.delete(t)),e},window.CustomElementRegistry.prototype.upgrade=function(){M.push(this),d.upgrade.apply(d,arguments),M.pop()},window.CustomElementRegistry.prototype.get=function(t){var n;return null==(n=this.l.get(t))?void 0:n.g},window.CustomElementRegistry.prototype.j=function(t){return this.l.get(t)},window.CustomElementRegistry.prototype.whenDefined=function(t){var n=this.j(t);if(void 0!==n)return Promise.resolve(n.g);var e=this.i.get(t);return void 0===e&&((e={}).promise=new Promise((function(t){return e.resolve=t})),this.i.set(t,e)),e.promise},window.CustomElementRegistry.prototype.m=function(t,n,e){var i=this.h.get(n);i||this.h.set(n,i=new Set),e?i.add(t):i.delete(t)},window.HTMLElement=function(){var t=l;if(t)return l=void 0,t;var n=m.get(this.constructor);if(!n)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return t=Reflect.construct(f,[],n.s),Object.setPrototypeOf(t,this.constructor.prototype),v.set(t,n),t},window.HTMLElement.prototype=f.prototype;var p=function(t){function n(){var n=Reflect.construct(f,[],this.constructor);Object.setPrototypeOf(n,HTMLElement.prototype);t:{var e=n.getRootNode();if(!(e===document||e instanceof ShadowRoot)){if((e=M[M.length-1])instanceof CustomElementRegistry){var i=e;break t}(e=e.getRootNode())===document||e instanceof ShadowRoot||(e=(null==(i=y.get(e))?void 0:i.getRootNode())||document)}i=e.customElements}return(e=(i=i||window.customElements).j(t))?E(n,e):b.set(n,i),n}return r.Object.defineProperty(n,"formAssociated",{configurable:!0,enumerable:!0,get:function(){return!0}}),n.prototype.connectedCallback=function(){var n=v.get(this);n?n.connectedCallback&&n.connectedCallback.apply(this,arguments):b.get(this).m(this,t,!0)},n.prototype.disconnectedCallback=function(){var n=v.get(this);n?n.disconnectedCallback&&n.disconnectedCallback.apply(this,arguments):b.get(this).m(this,t,!1)},n.prototype.adoptedCallback=function(){var t,n;null==(t=v.get(this))||null==(n=t.adoptedCallback)||n.apply(this,arguments)},n.prototype.formAssociatedCallback=function(){var t,n=v.get(this);n&&n.formAssociated&&(null==n||null==(t=n.formAssociatedCallback)||t.apply(this,arguments))},n.prototype.formDisabledCallback=function(){var t,n=v.get(this);null!=n&&n.formAssociated&&(null==n||null==(t=n.formDisabledCallback)||t.apply(this,arguments))},n.prototype.formResetCallback=function(){var t,n=v.get(this);null!=n&&n.formAssociated&&(null==n||null==(t=n.formResetCallback)||t.apply(this,arguments))},n.prototype.formStateRestoreCallback=function(){var t,n=v.get(this);null!=n&&n.formAssociated&&(null==n||null==(t=n.formStateRestoreCallback)||t.apply(this,arguments))},n},j=function(t,n,e){if(0!==n.size&&void 0!==e){var i=t.prototype.setAttribute;i&&(t.prototype.setAttribute=function(t,o){if(t=t.toLowerCase(),n.has(t)){var r=this.getAttribute(t);i.call(this,t,o),e.call(this,t,r,o)}else i.call(this,t,o)});var o=t.prototype.removeAttribute;o&&(t.prototype.removeAttribute=function(t){if(t=t.toLowerCase(),n.has(t)){var i=this.getAttribute(t);o.call(this,t),e.call(this,t,i,null)}else o.call(this,t)})}},g=function(t){var n=Object.getPrototypeOf(t);if(n!==window.HTMLElement)return n===f?Object.setPrototypeOf(t,window.HTMLElement):g(n)},E=function(t,n,e){e=void 0!==e&&e,Object.setPrototypeOf(t,n.g.prototype),v.set(t,n),l=t;try{new n.g}catch(t){g(n.g),new n.g}n.observedAttributes.forEach((function(e){t.hasAttribute(e)&&n.attributeChangedCallback.call(t,e,null,t.getAttribute(e))})),e&&n.connectedCallback&&t.isConnected&&n.connectedCallback.call(t)},O=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){var n=O.apply(this,arguments);return t.customElements&&(n.customElements=t.customElements),n};var M=[document],R=function(t,n,e){var i=(e?Object.getPrototypeOf(e):t.prototype)[n];t.prototype[n]=function(){M.push(this);var t=i.apply(e||this,arguments);return void 0!==t&&y.set(t,this),M.pop(),t}};R(ShadowRoot,"createElement",document),R(ShadowRoot,"importNode",document),R(Element,"insertAdjacentHTML");var k=function(t){var n=Object.getOwnPropertyDescriptor(t.prototype,"innerHTML");Object.defineProperty(t.prototype,"innerHTML",Object.assign({},n,{set:function(t){M.push(this),n.set.call(this,t),M.pop()}}))};if(k(Element),k(ShadowRoot),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){var C=new WeakMap,T=HTMLElement.prototype.attachInternals;HTMLElement.prototype.attachInternals=function(t){for(var n=[],i=0;i<arguments.length;++i)n[i]=arguments[i];return n=T.call.apply(T,[this].concat(e(n))),C.set(n,this),n},["setFormValue","setValidity","checkValidity","reportValidity"].forEach((function(t){var n=window.ElementInternals.prototype,i=n[t];n[t]=function(t){for(var n=[],o=0;o<arguments.length;++o)n[o]=arguments[o];if(o=C.get(this),!0!==v.get(o).formAssociated)throw new DOMException("Failed to execute "+i+" on 'ElementInternals': The target element is not a form-associated custom element.");null==i||i.call.apply(i,[this].concat(e(n)))}}));var S=function(t){var n=a(Array,[].concat(e(t)),this.constructor);return n.h=t,n},x=S,A=Array;if(x.prototype=i(A.prototype),x.prototype.constructor=x,s)s(x,A);else for(var H in A)if("prototype"!=H)if(Object.defineProperties){var L=Object.getOwnPropertyDescriptor(A,H);L&&Object.defineProperty(x,H,L)}else x[H]=A[H];x.u=A.prototype,r.Object.defineProperty(S.prototype,"value",{configurable:!0,enumerable:!0,get:function(){var t;return(null==(t=this.h.find((function(t){return!0===t.checked})))?void 0:t.value)||""}});var F=function(t){var n=this,e=new Map;t.forEach((function(t,i){var o=t.getAttribute("name"),r=e.get(o)||[];n[+i]=t,r.push(t),e.set(o,r)})),this.length=t.length,e.forEach((function(t,e){t&&(n[e]=1===t.length?t[0]:new S(t))}))};F.prototype.namedItem=function(t){return this[t]};var W=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){for(var t=W.get.call(this,[]),e=[],i=(t=n(t)).next();!i.done;i=t.next()){i=i.value;var o=v.get(i);o&&!0!==o.formAssociated||e.push(i)}return new F(e)}})}}}).call(self);try{window.customElements.define("custom-element",null)}catch(t){const n=window.customElements.define;window.customElements.define=(t,e,i)=>{try{n.bind(window.customElements)(t,e,i)}catch(n){console.warn(t,e,i,n)}}}}();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function rawHtmlStory(rawHtml: string): {
|
|
2
|
+
(): import("lit-html").TemplateResult<1>;
|
|
3
|
+
parameters: {
|
|
4
|
+
docs: {
|
|
5
|
+
source: {
|
|
6
|
+
code: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function rawCodeStory(story: any): void;
|
|
12
|
+
//# sourceMappingURL=storybook.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
3
|
+
export function rawHtmlStory(rawHtml) {
|
|
4
|
+
const story = () => html `${unsafeHTML(rawHtml)}`;
|
|
5
|
+
story.parameters = {
|
|
6
|
+
docs: {
|
|
7
|
+
source: {
|
|
8
|
+
code: rawHtml,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
return story;
|
|
13
|
+
}
|
|
14
|
+
export function rawCodeStory(story) {
|
|
15
|
+
story.parameters = {
|
|
16
|
+
docs: {
|
|
17
|
+
source: {
|
|
18
|
+
type: "code",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=storybook.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluid-topics/ft-wc-utils",
|
|
3
|
+
"version": "0.0.88",
|
|
4
|
+
"description": "Internal web components tools",
|
|
5
|
+
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"main": "build/index.js",
|
|
8
|
+
"typings": "build/index",
|
|
9
|
+
"files": [
|
|
10
|
+
"build/*.ts",
|
|
11
|
+
"build/*.js"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@lit-labs/scoped-registry-mixin": "1.0.0",
|
|
15
|
+
"@reduxjs/toolkit": "^1.6.2",
|
|
16
|
+
"@webcomponents/scoped-custom-element-registry": "0.0.4"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"lit": "^2.0.2"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "220e53dba55dfa1de1560abbc30067555f72198c"
|
|
22
|
+
}
|