@instantdb/core
Advanced tools
Comparing version 0.11.5 to 0.12.0
@@ -71,4 +71,10 @@ "use strict"; | ||
function createToggler(onClick) { | ||
const logoSVG = ` | ||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<rect width="512" height="512" fill="black"/> | ||
<rect x="97.0973" y="91.3297" width="140" height="330" fill="white"/> | ||
</svg> | ||
`; | ||
const element = document.createElement("button"); | ||
element.innerText = "λ"; | ||
element.innerHTML = logoSVG; | ||
Object.assign(element.style, { | ||
@@ -85,11 +91,2 @@ // pos | ||
justifyContent: "center", | ||
// hardcode look and feel defaults | ||
color: "#fff", | ||
backgroundColor: "#444", | ||
fontSize: "16px", | ||
fontFamily: "sans-serif", | ||
fontStyle: "normal", | ||
border: "1px white solid", | ||
borderRadius: "8px", | ||
zIndex: "999991", | ||
}); | ||
@@ -96,0 +93,0 @@ element.addEventListener("click", onClick); |
@@ -68,4 +68,10 @@ let currentDevtool; | ||
function createToggler(onClick) { | ||
const logoSVG = ` | ||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<rect width="512" height="512" fill="black"/> | ||
<rect x="97.0973" y="91.3297" width="140" height="330" fill="white"/> | ||
</svg> | ||
`; | ||
const element = document.createElement("button"); | ||
element.innerText = "λ"; | ||
element.innerHTML = logoSVG; | ||
Object.assign(element.style, { | ||
@@ -82,11 +88,2 @@ // pos | ||
justifyContent: "center", | ||
// hardcode look and feel defaults | ||
color: "#fff", | ||
backgroundColor: "#444", | ||
fontSize: "16px", | ||
fontFamily: "sans-serif", | ||
fontStyle: "normal", | ||
border: "1px white solid", | ||
borderRadius: "8px", | ||
zIndex: "999991", | ||
}); | ||
@@ -93,0 +90,0 @@ element.addEventListener("click", onClick); |
export { graph, entity, string, number, boolean, json, any, InstaQLQueryResult, }; | ||
/** | ||
* Your app's graph definition. | ||
* Accepts entities and links and merges them into a single graph definition. | ||
* | ||
* @template EntitiesWithoutLinks - The type definition for entities without links. | ||
* @template Links - The type definition for links. | ||
* @param {string} appId - The ID of the application. | ||
* @param {EntitiesWithoutLinks} entities - The entities without links. | ||
* @param {Links} links - The links between entities. | ||
* @returns {InstantGraph} - The new InstantGraph instance. | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @example | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }), | ||
* }, | ||
* { | ||
* postsComments: { | ||
* forward: { | ||
* on: "posts", | ||
* has: "many", | ||
* label: "comments", | ||
* }, | ||
* reverse: { | ||
* on: "comments", | ||
* has: "one", | ||
* label: "post", | ||
* }, | ||
* }, | ||
* }, | ||
* ); | ||
*/ | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(appId: string, entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>>; | ||
/** | ||
* Creates an entity definition with the given attributes. | ||
* Creates an entity definition, to be used in conjunction with `i.graph`. | ||
* | ||
* @template Attrs - The type of the attributes. | ||
* @param {Attrs extends AttrsDefs} attrs - The attributes for the entity. | ||
* @returns {EntityDef<Attrs, {}>} - The entity definition. | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @example | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }) | ||
* } | ||
*/ | ||
@@ -20,0 +50,0 @@ declare function entity<Attrs extends AttrsDefs>(attrs: Attrs): EntityDef<Attrs, {}>; |
@@ -9,10 +9,32 @@ export { | ||
/** | ||
* Your app's graph definition. | ||
* Accepts entities and links and merges them into a single graph definition. | ||
* | ||
* @template EntitiesWithoutLinks - The type definition for entities without links. | ||
* @template Links - The type definition for links. | ||
* @param {string} appId - The ID of the application. | ||
* @param {EntitiesWithoutLinks} entities - The entities without links. | ||
* @param {Links} links - The links between entities. | ||
* @returns {InstantGraph} - The new InstantGraph instance. | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @example | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }), | ||
* }, | ||
* { | ||
* postsComments: { | ||
* forward: { | ||
* on: "posts", | ||
* has: "many", | ||
* label: "comments", | ||
* }, | ||
* reverse: { | ||
* on: "comments", | ||
* has: "one", | ||
* label: "post", | ||
* }, | ||
* }, | ||
* }, | ||
* ); | ||
*/ | ||
@@ -29,7 +51,15 @@ function graph(appId, entities, links) { | ||
/** | ||
* Creates an entity definition with the given attributes. | ||
* Creates an entity definition, to be used in conjunction with `i.graph`. | ||
* | ||
* @template Attrs - The type of the attributes. | ||
* @param {Attrs extends AttrsDefs} attrs - The attributes for the entity. | ||
* @returns {EntityDef<Attrs, {}>} - The entity definition. | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @example | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }) | ||
* } | ||
*/ | ||
@@ -36,0 +66,0 @@ function entity(attrs) { |
export { graph, entity, string, number, boolean, json, any, InstaQLQueryResult, }; | ||
/** | ||
* Your app's graph definition. | ||
* Accepts entities and links and merges them into a single graph definition. | ||
* | ||
* @template EntitiesWithoutLinks - The type definition for entities without links. | ||
* @template Links - The type definition for links. | ||
* @param {string} appId - The ID of the application. | ||
* @param {EntitiesWithoutLinks} entities - The entities without links. | ||
* @param {Links} links - The links between entities. | ||
* @returns {InstantGraph} - The new InstantGraph instance. | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @example | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }), | ||
* }, | ||
* { | ||
* postsComments: { | ||
* forward: { | ||
* on: "posts", | ||
* has: "many", | ||
* label: "comments", | ||
* }, | ||
* reverse: { | ||
* on: "comments", | ||
* has: "one", | ||
* label: "post", | ||
* }, | ||
* }, | ||
* }, | ||
* ); | ||
*/ | ||
declare function graph<EntitiesWithoutLinks extends EntitiesDef, const Links extends LinksDef<EntitiesWithoutLinks>>(appId: string, entities: EntitiesWithoutLinks, links: Links): InstantGraph<EntitiesWithLinks<EntitiesWithoutLinks, Links>, LinksDef<any>>; | ||
/** | ||
* Creates an entity definition with the given attributes. | ||
* Creates an entity definition, to be used in conjunction with `i.graph`. | ||
* | ||
* @template Attrs - The type of the attributes. | ||
* @param {Attrs extends AttrsDefs} attrs - The attributes for the entity. | ||
* @returns {EntityDef<Attrs, {}>} - The entity definition. | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @example | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }) | ||
* } | ||
*/ | ||
@@ -20,0 +50,0 @@ declare function entity<Attrs extends AttrsDefs>(attrs: Attrs): EntityDef<Attrs, {}>; |
@@ -13,10 +13,32 @@ "use strict"; | ||
/** | ||
* Your app's graph definition. | ||
* Accepts entities and links and merges them into a single graph definition. | ||
* | ||
* @template EntitiesWithoutLinks - The type definition for entities without links. | ||
* @template Links - The type definition for links. | ||
* @param {string} appId - The ID of the application. | ||
* @param {EntitiesWithoutLinks} entities - The entities without links. | ||
* @param {Links} links - The links between entities. | ||
* @returns {InstantGraph} - The new InstantGraph instance. | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @example | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }), | ||
* }, | ||
* { | ||
* postsComments: { | ||
* forward: { | ||
* on: "posts", | ||
* has: "many", | ||
* label: "comments", | ||
* }, | ||
* reverse: { | ||
* on: "comments", | ||
* has: "one", | ||
* label: "post", | ||
* }, | ||
* }, | ||
* }, | ||
* ); | ||
*/ | ||
@@ -33,7 +55,15 @@ function graph(appId, entities, links) { | ||
/** | ||
* Creates an entity definition with the given attributes. | ||
* Creates an entity definition, to be used in conjunction with `i.graph`. | ||
* | ||
* @template Attrs - The type of the attributes. | ||
* @param {Attrs extends AttrsDefs} attrs - The attributes for the entity. | ||
* @returns {EntityDef<Attrs, {}>} - The entity definition. | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @example | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }) | ||
* } | ||
*/ | ||
@@ -40,0 +70,0 @@ function entity(attrs) { |
{ | ||
"name": "@instantdb/core", | ||
"version": "0.11.5", | ||
"version": "0.12.0", | ||
"description": "Instant's core local abstraction", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -85,4 +85,10 @@ type Devtool = { dispose: () => void }; | ||
function createToggler(onClick) { | ||
const logoSVG = ` | ||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<rect width="512" height="512" fill="black"/> | ||
<rect x="97.0973" y="91.3297" width="140" height="330" fill="white"/> | ||
</svg> | ||
`; | ||
const element = document.createElement("button"); | ||
element.innerText = "λ"; | ||
element.innerHTML = logoSVG; | ||
Object.assign(element.style, { | ||
@@ -99,11 +105,2 @@ // pos | ||
justifyContent: "center", | ||
// hardcode look and feel defaults | ||
color: "#fff", | ||
backgroundColor: "#444", | ||
fontSize: "16px", | ||
fontFamily: "sans-serif", | ||
fontStyle: "normal", | ||
border: "1px white solid", | ||
borderRadius: "8px", | ||
zIndex: "999991", | ||
} as Partial<CSSStyleDeclaration>); | ||
@@ -110,0 +107,0 @@ element.addEventListener("click", onClick); |
@@ -19,10 +19,32 @@ export { | ||
/** | ||
* Your app's graph definition. | ||
* Accepts entities and links and merges them into a single graph definition. | ||
* | ||
* @template EntitiesWithoutLinks - The type definition for entities without links. | ||
* @template Links - The type definition for links. | ||
* @param {string} appId - The ID of the application. | ||
* @param {EntitiesWithoutLinks} entities - The entities without links. | ||
* @param {Links} links - The links between entities. | ||
* @returns {InstantGraph} - The new InstantGraph instance. | ||
* @see https://docs.instantdb.com/docs/schema#defining-entities | ||
* @example | ||
* export default i.graph( | ||
* APP_ID, | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }), | ||
* }, | ||
* { | ||
* postsComments: { | ||
* forward: { | ||
* on: "posts", | ||
* has: "many", | ||
* label: "comments", | ||
* }, | ||
* reverse: { | ||
* on: "comments", | ||
* has: "one", | ||
* label: "post", | ||
* }, | ||
* }, | ||
* }, | ||
* ); | ||
*/ | ||
@@ -46,7 +68,15 @@ function graph< | ||
/** | ||
* Creates an entity definition with the given attributes. | ||
* Creates an entity definition, to be used in conjunction with `i.graph`. | ||
* | ||
* @template Attrs - The type of the attributes. | ||
* @param {Attrs extends AttrsDefs} attrs - The attributes for the entity. | ||
* @returns {EntityDef<Attrs, {}>} - The entity definition. | ||
* @see https://docs.instantdb.com/docs/schema | ||
* @example | ||
* { | ||
* posts: i.entity({ | ||
* title: i.string(), | ||
* body: i.string(), | ||
* }), | ||
* comments: i.entity({ | ||
* body: i.string(), | ||
* }) | ||
* } | ||
*/ | ||
@@ -53,0 +83,0 @@ function entity<Attrs extends AttrsDefs>(attrs: Attrs): EntityDef<Attrs, {}> { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1621679
34027