element-vir 0.2.1 → 1.0.0

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.
@@ -1,4 +1,4 @@
1
1
  import { EventsInitMap } from './element-events';
2
2
  import { PropertyInitMapBase } from './element-properties';
3
- import { FunctionalElementConstructor, FunctionalElementInit } from './functional-element';
4
- export declare function defineFunctionalElement<EventsInitGeneric extends EventsInitMap = never, PropertyInitGeneric extends PropertyInitMapBase = never>(functionalElementInit: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>): FunctionalElementConstructor<PropertyInitGeneric, EventsInitGeneric>;
3
+ import { FunctionalElement, FunctionalElementInit } from './functional-element';
4
+ export declare function defineFunctionalElement<EventsInitGeneric extends EventsInitMap = {}, PropertyInitGeneric extends PropertyInitMapBase = {}>(functionalElementInit: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>): FunctionalElement<PropertyInitGeneric, EventsInitGeneric>;
@@ -0,0 +1,3 @@
1
+ import { CSSResult } from 'lit';
2
+ import { FunctionalElement } from '../functional-element';
3
+ export declare function cssSelector(element: FunctionalElement): CSSResult;
@@ -0,0 +1,6 @@
1
+ import { unsafeCSS } from 'lit';
2
+ export function cssSelector(element) {
3
+ // This is actually safe because it's not user input.
4
+ // If the dev using this package allows user input for tag names... all hope is lost anyway.
5
+ return unsafeCSS(element.tagName);
6
+ }
@@ -23,8 +23,8 @@ export declare abstract class FunctionalElementBaseClass<PropertyInitGeneric ext
23
23
  abstract render(): TemplateResult | Promise<TemplateResult>;
24
24
  abstract readonly instanceProps: PropertyInitGeneric;
25
25
  }
26
- export declare type FunctionalElementInstance<PropertyInitGeneric extends PropertyInitMapBase> = FunctionalElementBaseClass<PropertyInitGeneric> & PropertyInitGeneric;
27
- export declare type FunctionalElementConstructor<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (new () => FunctionalElementInstance<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
26
+ export declare type FunctionalElementInstance<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & PropertyInitGeneric;
27
+ export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstance<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
28
28
  export declare type ExtraStaticFunctionalElementProperties<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = Readonly<{
29
29
  /** Pass through the render callback for direct unit testability */
30
30
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './functional-element/define-functional-element';
2
2
  export * from './functional-element/directives/assign-with-clean-up.directive';
3
3
  export * from './functional-element/directives/assign.directive';
4
+ export * from './functional-element/directives/cssSelector';
4
5
  export * from './functional-element/directives/listen.directive';
5
6
  export * from './functional-element/directives/on-dom-created.directive';
6
7
  export * from './functional-element/directives/on-resize.directive';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './functional-element/define-functional-element';
2
2
  export * from './functional-element/directives/assign-with-clean-up.directive';
3
3
  export * from './functional-element/directives/assign.directive';
4
+ export * from './functional-element/directives/cssSelector';
4
5
  export * from './functional-element/directives/listen.directive';
5
6
  export * from './functional-element/directives/on-dom-created.directive';
6
7
  export * from './functional-element/directives/on-resize.directive';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "element-vir",
3
- "version": "0.2.1",
3
+ "version": "1.0.0",
4
4
  "keywords": [
5
5
  "custom",
6
6
  "web",
@@ -29,7 +29,7 @@
29
29
  "format": "virmator format write",
30
30
  "prepublishOnly": "npm run test:full",
31
31
  "spellcheck": "virmator spellcheck",
32
- "start": "snowpack dev --reload",
32
+ "start": "snowpack dev",
33
33
  "test:full": "npm test && npm run spellcheck && virmator format check",
34
34
  "test": "npm run compile"
35
35
  },
@@ -38,8 +38,9 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@snowpack/plugin-typescript": "^1.2.1",
41
+ "augment-vir": "^1.0.0",
41
42
  "snowpack": "^3.8.8",
42
43
  "typescript": "^4.4.3",
43
- "virmator": "^1.1.15"
44
+ "virmator": "^1.2.0"
44
45
  }
45
46
  }