New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@apollo-elements/lib

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo-elements/lib - npm Package Compare versions

Comparing version 3.5.0-alpha.1 to 4.0.0-alpha.0

docs/create-apollo-client.draft.md

23

CHANGELOG.md

@@ -6,2 +6,25 @@ # Change Log

# [4.0.0-alpha.0](https://github.com/apollo-elements/apollo-elements/compare/@apollo-elements/lib@3.5.0-alpha.0...@apollo-elements/lib@4.0.0-alpha.0) (2020-12-21)
### Bug Fixes
* **lib:** export maps ([93e0489](https://github.com/apollo-elements/apollo-elements/commit/93e04895bc2a4a7b0409907ac1f4e94f2cfcbf7b))
### Features
* support for TypedDocumentNode ([d39ca4e](https://github.com/apollo-elements/apollo-elements/commit/d39ca4e0094220cfceba97b9bfe59ed078045560))
### BREAKING CHANGES
* **lib:** rename apply to applyPrototype in @apollo-elements/lib
affects: @apollo-elements/lib
# [3.5.0-alpha.1](https://github.com/apollo-elements/apollo-elements/compare/@apollo-elements/lib@3.5.0-alpha.0...@apollo-elements/lib@3.5.0-alpha.1) (2020-12-05)

@@ -8,0 +31,0 @@

1

index.d.ts

@@ -5,1 +5,2 @@ export { hasAllVariables } from './has-all-variables';

export { booleanAttr, effect, gqlDocument, writable } from './descriptors';
export { applyPrototype } from './prototypes';

@@ -5,2 +5,3 @@ export { hasAllVariables } from './has-all-variables';

export { booleanAttr, effect, gqlDocument, writable } from './descriptors';
export { applyPrototype } from './prototypes';
//# sourceMappingURL=index.js.map

@@ -6,1 +6,3 @@ export { hasAllVariables } from './has-all-variables';

export { booleanAttr, effect, gqlDocument, writable } from './descriptors';
export { applyPrototype } from './prototypes';

22

package.json
{
"name": "@apollo-elements/lib",
"version": "3.5.0-alpha.1",
"version": "4.0.0-alpha.0",
"description": "Library functions for apollo-elements",

@@ -11,14 +11,18 @@ "main": "index.js",

".": "./index.js",
"./create-apollo-client": "./create-apollo-client.js",
"./create-apollo-client.js": "./create-apollo-client.js",
"./descriptors": "./descriptors.js",
"./descriptors.js": "./descriptors.js",
"./has-all-variables": "./has-all-variables.js",
"./has-all-variables.js": "./has-all-variables.js",
"./helpers": "./helpers.js",
"./helpers.js": "./helpers.js",
"./index": "./index.js",
"./index.js": "./index.js",
"./escape": "./escape.js",
"./escape.js": "./escape.js",
"./helpers": "./helpers.js",
"./helpers.js": "./helpers.js",
"./has-all-variables": "./has-all-variables.js",
"./has-all-variables.js": "./has-all-variables.js",
"./is-client-operation": "./is-client-operation.js",
"./is-client-operation.js": "./is-client-operation.js",
"./is-valid-gql": "./is-valid-gql.js",
"./is-valid-gql.js": "./is-valid-gql.js"
"./is-valid-gql.js": "./is-valid-gql.js",
"./prototypes": "./prototypes.js",
"./prototypes.js": "./prototypes.js"
},

@@ -58,3 +62,3 @@ "scripts": {

},
"gitHead": "20383fd2003cf7fec69965500b33e5ec9828e332"
"gitHead": "af13339031be09f464fed1958224a44043d971a3"
}

@@ -5,4 +5,13 @@ import type { Constructor } from '@apollo-elements/interfaces';

export declare function getDescriptor<T extends HTMLElement>(host: T): PropertyDescriptorMap;
export declare function applyPrototype<S extends HTMLElement>(target: S, source: Constructor<S>): PropertyDescriptorMap;
export declare function apply<T extends ApolloElementElement<any, any>>(host: T, klass: Constructor<T> | typeof ApolloElementElement, type: Type, effects?: (host: T) => void): PropertyDescriptorMap;
/**
* Applies a class' prototype to an element, mixing in the class' properties and methods to the element instance.
*
* @param host Element to apply prototype properties to.
* @param klass Class whose prototype to apply to the host element.
* @param type Hint about what kind of class/host pair is in question.
* @param effects function that will run the first time this element has a class prototype mixed in via this helper.
* @return Combined `PropertyDescriptorMap` for the instance.
*/
export declare function applyPrototype<T extends ApolloElementElement<any, any>>(// eslint-disable-line @typescript-eslint/no-explicit-any
host: T, klass: Constructor<T> | typeof ApolloElementElement, type: Type, effects?: (host: T) => void): PropertyDescriptorMap;
export {};
import { ApolloElementElement } from '@apollo-elements/interfaces/apollo-element';
import { cuid } from './cuid';
const noop = () => void null;
const INSTANCES = new WeakMap();

@@ -30,3 +31,3 @@ const DESCRIPTORS = new WeakMap();

}
export function applyPrototype(target, source) {
function unsafeApplyPrototype(target, source) {
const descriptors = getPrototypeDescriptor(source);

@@ -47,3 +48,3 @@ const propertiesToAssign = Object.fromEntries(Object.entries(descriptors).map(([key, descriptor]) => {

...getElementDescriptor(host),
...applyPrototype(host, klass),
...unsafeApplyPrototype(host, klass),
});

@@ -54,6 +55,15 @@ }

ELEMENT_APPLIED
.set(host, applyPrototype(host, ApolloElementElement));
.set(host, unsafeApplyPrototype(host, ApolloElementElement));
}
const noop = () => void null;
export function apply(host, klass, type, effects = noop) {
/**
* Applies a class' prototype to an element, mixing in the class' properties and methods to the element instance.
*
* @param host Element to apply prototype properties to.
* @param klass Class whose prototype to apply to the host element.
* @param type Hint about what kind of class/host pair is in question.
* @param effects function that will run the first time this element has a class prototype mixed in via this helper.
* @return Combined `PropertyDescriptorMap` for the instance.
*/
export function applyPrototype(// eslint-disable-line @typescript-eslint/no-explicit-any
host, klass, type, effects = noop) {
if (!isElementApplied(host) || klass === ApolloElementElement) /* c8 ignore next */ // covered

@@ -60,0 +70,0 @@ unsafeApplyElement(host, effects);

@@ -8,2 +8,4 @@ import type { Constructor } from '@apollo-elements/interfaces';

const noop = () => void null;
const INSTANCES = new WeakMap();

@@ -49,3 +51,3 @@

export function applyPrototype<S extends HTMLElement>(
function unsafeApplyPrototype<S extends HTMLElement>(
target: S,

@@ -81,3 +83,3 @@ source: Constructor<S>,

...getElementDescriptor(host),
...applyPrototype(host, klass),
...unsafeApplyPrototype(host, klass),
});

@@ -92,8 +94,15 @@ }

ELEMENT_APPLIED
.set(host, applyPrototype(host, ApolloElementElement));
.set(host, unsafeApplyPrototype(host, ApolloElementElement));
}
const noop = () => void null;
export function apply<T extends ApolloElementElement<any, any>>(
/**
* Applies a class' prototype to an element, mixing in the class' properties and methods to the element instance.
*
* @param host Element to apply prototype properties to.
* @param klass Class whose prototype to apply to the host element.
* @param type Hint about what kind of class/host pair is in question.
* @param effects function that will run the first time this element has a class prototype mixed in via this helper.
* @return Combined `PropertyDescriptorMap` for the instance.
*/
export function applyPrototype<T extends ApolloElementElement<any, any>>( // eslint-disable-line @typescript-eslint/no-explicit-any
host: T,

@@ -100,0 +109,0 @@ klass: Constructor<T> | typeof ApolloElementElement,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc