diff --git a/packages/lit-dev-api/api-data/lit-2/pages.json b/packages/lit-dev-api/api-data/lit-2/pages.json index e4c34714b..fcecf4bf7 100644 --- a/packages/lit-dev-api/api-data/lit-2/pages.json +++ b/packages/lit-dev-api/api-data/lit-2/pages.json @@ -29178,5 +29178,4003 @@ } } ] + }, + { + "slug": "context", + "title": "Context", + "labs": true, + "repo": "lit/lit", + "commit": "c134604f178e36444261d83eabe9e578c1ed90c4", + "items": [ + { + "name": "createContext", + "comment": { + "blockTags": [ + { + "tag": "@returns", + "content": [ + { + "text": "the context key value cast to " + }, + { + "text": "`Context`" + } + ] + } + ], + "shortText": "Creates a typed Context.", + "text": "Contexts are compared with with strict equality.\nIf you want two separate `createContext()` calls to referer to the same\ncontext, then use a key that will by equal under strict equality like a\nstring for `Symbol.for()`:\n```ts\n// true\ncreateContext('my-context') === createContext('my-context')\n// true\ncreateContext(Symbol.for('my-context')) === createContext(Symbol.for('my-context'))\n```\nIf you want a context to be unique so that it's guaranteed to not collide\nwith other contexts, use a key that's unique under strict equality, like\na `Symbol()` or object.:\n```\n// false\ncreateContext({}) === createContext({})\n// false\ncreateContext(Symbol('my-context')) === createContext(Symbol('my-context'))\n```\n" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 54, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "createContext", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 54 + } + ], + "typeParameter": [ + { + "name": "ValueType", + "comment": { + "summary": [ + { + "text": "the type of value that can be provided by this context." + } + ] + }, + "kindString": "Type parameter" + }, + { + "name": "K", + "default": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "key", + "comment": { + "shortText": "a context key value" + }, + "type": { + "type": "reference", + "name": "K" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "K" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Call signature" + } + ], + "kindString": "Function", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "createContext" + } + }, + { + "name": "consume", + "comment": { + "blockTags": [ + { + "tag": "@example", + "content": [ + { + "text": "```ts\nimport {consume} from '@lit-labs/context';\nimport {loggerContext, Logger} from 'community-protocols/logger';\n\nclass MyElement {\n @consume({context: loggerContext})\n logger?: Logger;\n\n doThing() {\n this.logger!.log('thing was done');\n }\n}\n```" + } + ] + } + ], + "shortText": "A property decorator that adds a ContextConsumer controller to the component\nwhich will try and retrieve a value for the property via the Context API." + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/decorators/consume.ts", + "line": 44, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "consume", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 44 + } + ], + "typeParameter": [ + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "__namedParameters", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "context", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 48 + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Property" + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 49 + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 47 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 50 + } + ], + "signatures": [ + { + "name": "__type", + "typeParameter": [ + { + "name": "K", + "type": { + "type": "reference", + "name": "PropertyKey", + "package": "typescript" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "protoOrDescriptor", + "type": { + "type": "intersection", + "types": [ + { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "K" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Record", + "package": "typescript" + } + ], + "name": "Partial", + "package": "typescript" + } + ] + }, + "kindString": "Parameter" + }, + { + "name": "name", + "flags": { + "isOptional": true + }, + "type": { + "type": "reference", + "name": "K" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "intrinsic", + "name": "void" + }, + { + "type": "intrinsic", + "name": "any" + } + ] + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Call signature" + } + ], + "kindString": "Function", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/decorators/consume.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "consume" + } + }, + { + "name": "provide", + "comment": { + "blockTags": [ + { + "tag": "@example", + "content": [ + { + "text": "```ts\nimport {consume} from '@lit-labs/context';\nimport {loggerContext} from 'community-protocols/logger';\n\nclass MyElement {\n @provide({context: loggerContext})\n logger;\n\n doThing() {\n this.logger.log('thing was done');\n }\n}\n```" + } + ] + } + ], + "shortText": "A property decorator that adds a ContextConsumer controller to the component\nwhich will try and retrieve a value for the property via the Context API." + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/decorators/provide.ts", + "line": 46, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "provide", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 46 + } + ], + "typeParameter": [ + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "__namedParameters", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "context", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 49 + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 48 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 50 + } + ], + "signatures": [ + { + "name": "__type", + "typeParameter": [ + { + "name": "K", + "type": { + "type": "reference", + "name": "PropertyKey", + "package": "typescript" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "protoOrDescriptor", + "type": { + "type": "intersection", + "types": [ + { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "K" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Record", + "package": "typescript" + } + ] + }, + "kindString": "Parameter" + }, + { + "name": "name", + "flags": { + "isOptional": true + }, + "type": { + "type": "reference", + "name": "K" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "intrinsic", + "name": "void" + }, + { + "type": "intrinsic", + "name": "any" + } + ] + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Call signature" + } + ], + "kindString": "Function", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/decorators/provide.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "provide" + } + }, + { + "name": "contextProvided", + "comment": { + "blockTags": [ + { + "tag": "@deprecated", + "content": [ + { + "text": "use " + }, + { + "text": "`consume`" + }, + { + "text": " instead" + } + ] + } + ] + }, + "sources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 37, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "contextProvided", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 44 + } + ], + "typeParameter": [ + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "__namedParameters", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "context", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 48 + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Property" + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 49 + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 47 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/consume.ts", + "line": 50 + } + ], + "signatures": [ + { + "name": "__type", + "typeParameter": [ + { + "name": "K", + "type": { + "type": "reference", + "name": "PropertyKey", + "package": "typescript" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "protoOrDescriptor", + "type": { + "type": "intersection", + "types": [ + { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "K" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Record", + "package": "typescript" + } + ], + "name": "Partial", + "package": "typescript" + } + ] + }, + "kindString": "Parameter" + }, + { + "name": "name", + "flags": { + "isOptional": true + }, + "type": { + "type": "reference", + "name": "K" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "intrinsic", + "name": "void" + }, + { + "type": "intrinsic", + "name": "any" + } + ] + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Call signature" + } + ], + "kindString": "Function", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "contextProvided" + } + }, + { + "name": "contextProvider", + "comment": { + "blockTags": [ + { + "tag": "@deprecated", + "content": [ + { + "text": "use " + }, + { + "text": "`provide`" + }, + { + "text": " instead" + } + ] + } + ] + }, + "sources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 32, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "contextProvider", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 46 + } + ], + "typeParameter": [ + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "__namedParameters", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "context", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 49 + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 48 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/decorators/provide.ts", + "line": 50 + } + ], + "signatures": [ + { + "name": "__type", + "typeParameter": [ + { + "name": "K", + "type": { + "type": "reference", + "name": "PropertyKey", + "package": "typescript" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "protoOrDescriptor", + "type": { + "type": "intersection", + "types": [ + { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "K" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Record", + "package": "typescript" + } + ] + }, + "kindString": "Parameter" + }, + { + "name": "name", + "flags": { + "isOptional": true + }, + "type": { + "type": "reference", + "name": "K" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "intrinsic", + "name": "void" + }, + { + "type": "intrinsic", + "name": "any" + } + ] + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Call signature" + } + ], + "kindString": "Function", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "contextProvider" + } + }, + { + "name": "ContextRoot", + "comment": { + "shortText": "A ContextRoot can be used to gather unsatisfied context requests and\nre-dispatch them when new providers which satisfy matching context keys are\navailable.", + "text": "This allows providers to be added to a DOM tree, or upgraded, after the\nconsumers.\n" + }, + "children": [ + { + "name": "constructor", + "signatures": [ + { + "name": "new ContextRoot", + "type": { + "type": "reference", + "name": "ContextRoot", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextRoot" + } + }, + "kindString": "Constructor signature" + } + ], + "kindString": "Constructor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRoot.constructor" + } + }, + { + "name": "attach", + "flags": { + "isPublic": true + }, + "comment": { + "shortText": "Attach the ContextRoot to a given element to intercept `context-request` and\n`context-provider` events." + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-root.ts", + "line": 44, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "attach", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/context-root.ts", + "line": 44 + } + ], + "parameters": [ + { + "name": "element", + "comment": { + "shortText": "an element to add event listeners to" + }, + "type": { + "type": "reference", + "name": "HTMLElement", + "package": "typescript", + "externalUrl": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRoot.attach" + } + }, + { + "name": "detach", + "flags": { + "isPublic": true + }, + "comment": { + "shortText": "Removes the ContextRoot event listeners from a given element." + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-root.ts", + "line": 54, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "detach", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/context-root.ts", + "line": 54 + } + ], + "parameters": [ + { + "name": "element", + "comment": { + "shortText": "an element from which to remove event listeners" + }, + "type": { + "type": "reference", + "name": "HTMLElement", + "package": "typescript", + "externalUrl": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRoot.detach" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-root.ts", + "line": 19, + "moduleSpecifier": "@lit-labs/context" + } + ], + "kindString": "Class", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/index.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRoot" + } + }, + { + "name": "ContextRequestEvent", + "comment": { + "shortText": "An event fired by a context requester to signal it desires a specified context with the given key.", + "text": "A provider should inspect the `context` property of the event to determine if it has a value that can\nsatisfy the request, calling the `callback` with the requested value if so.\nIf the requested context event contains a truthy `subscribe` value, then a provider can call the callback\nmultiple times if the value is changed, if this is the case the provider should pass an `unsubscribe`\nmethod to the callback which consumers can invoke to indicate they no longer wish to receive these updates.\nIf no `subscribe` value is present in the event, then the provider can assume that this is a 'one time'\nrequest for the context and can therefore not track the consumer.\n" + }, + "children": [ + { + "name": "constructor", + "flags": { + "isPublic": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 60, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "new ContextRequestEvent", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/context-request-event.ts", + "line": 60 + } + ], + "typeParameter": [ + { + "name": "C", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "context", + "comment": { + "shortText": "the context key to request" + }, + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Parameter" + }, + { + "name": "callback", + "comment": { + "shortText": "the callback that should be invoked when the context with the specified key is available" + }, + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ContextCallback", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextCallback" + } + }, + "kindString": "Parameter" + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "comment": { + "shortText": "an optional argument, if true indicates we want to subscribe to future updates" + }, + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextRequestEvent", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextRequestEvent" + } + }, + "overwrites": { + "type": "reference", + "name": "Event.constructor" + }, + "kindString": "Constructor signature" + } + ], + "overwrites": { + "type": "reference", + "name": "Event.constructor" + }, + "kindString": "Constructor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequestEvent.constructor" + } + }, + { + "name": "callback", + "flags": { + "isPublic": true, + "isReadonly": true + }, + "comment": { + "shortText": "the callback that should be invoked when the context with the specified key is available" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 62, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ContextCallback", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextCallback" + } + }, + "implementationOf": { + "type": "reference", + "name": "ContextRequest.callback", + "location": { + "page": "context", + "anchor": "ContextRequest.callback" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequestEvent.callback" + } + }, + { + "name": "context", + "flags": { + "isPublic": true, + "isReadonly": true + }, + "comment": { + "shortText": "the context key to request" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 61, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "C" + }, + "implementationOf": { + "type": "reference", + "name": "ContextRequest.context", + "location": { + "page": "context", + "anchor": "ContextRequest.context" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequestEvent.context" + } + }, + { + "name": "subscribe", + "flags": { + "isPublic": true, + "isOptional": true, + "isReadonly": true + }, + "comment": { + "shortText": "an optional argument, if true indicates we want to subscribe to future updates" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 63, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "implementationOf": { + "type": "reference", + "name": "ContextRequest.subscribe", + "location": { + "page": "context", + "anchor": "ContextRequest.subscribe" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequestEvent.subscribe" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 50, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "extendedTypes": [ + { + "type": "reference", + "name": "Event", + "package": "typescript" + } + ], + "implementedTypes": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextRequest", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextRequest" + } + } + ], + "kindString": "Class", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequestEvent" + }, + "heritage": [ + { + "type": "reference", + "name": "Event", + "package": "typescript" + } + ] + }, + { + "name": "ContextCallback", + "comment": { + "shortText": "A callback which is provided by a context requester and is called with the value satisfying the request.\nThis callback can be called multiple times by context providers as the requested value is changed." + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 23, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/context-request-event.ts", + "line": 23 + } + ], + "signatures": [ + { + "name": "__type", + "comment": { + "shortText": "A callback which is provided by a context requester and is called with the value satisfying the request.\nThis callback can be called multiple times by context providers as the requested value is changed." + }, + "parameters": [ + { + "name": "value", + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Parameter" + }, + { + "name": "unsubscribe", + "flags": { + "isOptional": true + }, + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/context-request-event.ts", + "line": 25 + } + ], + "signatures": [ + { + "name": "__type", + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type alias", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextCallback" + } + }, + { + "name": "ContextRequest", + "comment": { + "shortText": "Interface definition for a ContextRequest" + }, + "children": [ + { + "name": "callback", + "flags": { + "isReadonly": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 33, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ContextCallback", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextCallback" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequest.callback" + } + }, + { + "name": "context", + "flags": { + "isReadonly": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 32, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequest.context" + } + }, + { + "name": "subscribe", + "flags": { + "isOptional": true, + "isReadonly": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 34, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequest.subscribe" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 31, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "implementedBy": [ + { + "type": "reference", + "name": "ContextRequestEvent", + "location": { + "page": "context", + "anchor": "ContextRequestEvent" + } + } + ], + "kindString": "Interface", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/context-request-event.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextRequest" + } + }, + { + "name": "ContextConsumer", + "comment": { + "shortText": "A ReactiveController which adds context consuming behavior to a custom\nelement by dispatching `context-request` events.", + "text": "When the host element is connected to the document it will emit a\n`context-request` event with its context key. When the context request\nis satisfied the controller will invoke the callback, if present, and\ntrigger a host update so it can respond to the new value.\nIt will also call the dispose method given by the provider when the\nhost element is disconnected.\n" + }, + "children": [ + { + "name": "constructor", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 46, + "moduleSpecifier": "@lit-labs/context" + }, + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 48, + "moduleSpecifier": "@lit-labs/context" + }, + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 54, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "new ContextConsumer", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 46 + } + ], + "typeParameter": [ + { + "name": "C", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + }, + { + "name": "HostElement", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "HostElement" + } + ], + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "host", + "type": { + "type": "reference", + "name": "HostElement" + }, + "kindString": "Parameter" + }, + { + "name": "options", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "Options", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Options" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + }, + { + "type": "reference", + "name": "HostElement" + } + ], + "name": "ContextConsumer", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextConsumer" + } + }, + "kindString": "Constructor signature" + }, + { + "name": "new ContextConsumer", + "comment": { + "blockTags": [ + { + "tag": "@deprecated", + "content": [ + { + "text": "Use new ContextConsumer(host, options)" + } + ] + } + ] + }, + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 48 + } + ], + "typeParameter": [ + { + "name": "C", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + }, + { + "name": "HostElement", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "HostElement" + } + ], + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "host", + "type": { + "type": "reference", + "name": "HostElement" + }, + "kindString": "Parameter" + }, + { + "name": "context", + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Parameter" + }, + { + "name": "callback", + "flags": { + "isOptional": true + }, + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 51 + } + ], + "signatures": [ + { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 51 + } + ], + "parameters": [ + { + "name": "value", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "kindString": "Parameter" + }, + { + "name": "dispose", + "flags": { + "isOptional": true + }, + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 51 + } + ], + "signatures": [ + { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 51 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + }, + { + "type": "reference", + "name": "HostElement" + } + ], + "name": "ContextConsumer", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextConsumer" + } + }, + "kindString": "Constructor signature" + } + ], + "kindString": "Constructor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer.constructor" + } + }, + { + "name": "host", + "flags": { + "isProtected": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 37, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "HostElement" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer.host" + } + }, + { + "name": "value", + "flags": { + "isPublic": true, + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 44, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "defaultValue": "undefined", + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer.value" + } + }, + { + "name": "hostConnected", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 78, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "hostConnected", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 78 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostConnected" + }, + "kindString": "Call signature" + } + ], + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostConnected" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer.hostConnected" + } + }, + { + "name": "hostDisconnected", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 82, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "hostDisconnected", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 82 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostDisconnected" + }, + "kindString": "Call signature" + } + ], + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostDisconnected" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer.hostDisconnected" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 32, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + }, + { + "name": "HostElement", + "type": { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Type parameter" + } + ], + "implementedTypes": [ + { + "type": "reference", + "name": "ReactiveController", + "package": "@lit/reactive-element" + } + ], + "kindString": "Class", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextConsumer" + } + }, + { + "name": "Options", + "children": [ + { + "name": "callback", + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 16, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 16 + } + ], + "signatures": [ + { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 16 + } + ], + "parameters": [ + { + "name": "value", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "kindString": "Parameter" + }, + { + "name": "dispose", + "flags": { + "isOptional": true + }, + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 16 + } + ], + "signatures": [ + { + "name": "__type", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 16 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options.callback" + } + }, + { + "name": "context", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 15, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options.context" + } + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 17, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options.subscribe" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 14, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "kindString": "Interface", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-consumer.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options" + } + }, + { + "name": "ContextProvider", + "comment": { + "shortText": "A ReactiveController which adds context provider behavior to a\ncustom element.", + "text": "This controller simply listens to the `context-request` event when\nthe host is connected to the DOM and registers the received callbacks\nagainst its observable Context implementation.\n" + }, + "children": [ + { + "name": "constructor", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 57, + "moduleSpecifier": "@lit-labs/context" + }, + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 59, + "moduleSpecifier": "@lit-labs/context" + }, + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 60, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "new ContextProvider", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 57 + } + ], + "typeParameter": [ + { + "name": "T", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "host", + "type": { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Parameter" + }, + { + "name": "options", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "Options", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Options" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextProvider", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextProvider" + } + }, + "overwrites": { + "type": "reference", + "name": "ValueNotifier>.constructor" + }, + "kindString": "Constructor signature" + }, + { + "name": "new ContextProvider", + "comment": { + "blockTags": [ + { + "tag": "@deprecated", + "content": [ + { + "text": "Use new ContextProvider(host, options)" + } + ] + } + ] + }, + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 59 + } + ], + "typeParameter": [ + { + "name": "T", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "host", + "type": { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Parameter" + }, + { + "name": "context", + "type": { + "type": "reference", + "name": "T" + }, + "kindString": "Parameter" + }, + { + "name": "initialValue", + "flags": { + "isOptional": true + }, + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextProvider", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextProvider" + } + }, + "overwrites": { + "type": "reference", + "name": "ValueNotifier>.constructor" + }, + "kindString": "Constructor signature" + } + ], + "overwrites": { + "type": "reference", + "name": "ValueNotifier>.constructor" + }, + "kindString": "Constructor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.constructor" + } + }, + { + "name": "host", + "flags": { + "isProtected": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 54, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "ReactiveElement", + "package": "@lit/reactive-element" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.host" + } + }, + { + "name": "value", + "flags": { + "isPublic": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 26, + "moduleSpecifier": "@lit-labs/context" + }, + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 29, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "T" + }, + "getSignature": { + "name": "value", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 26 + } + ], + "type": { + "type": "reference", + "name": "T" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.value" + }, + "kindString": "Get signature" + }, + "setSignature": { + "name": "value", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 29 + } + ], + "parameters": [ + { + "name": "v", + "type": { + "type": "reference", + "name": "T" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.value" + }, + "kindString": "Set signature" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.value" + }, + "kindString": "Accessor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.value" + } + }, + { + "name": "addCallback", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 53, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "addCallback", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 53 + } + ], + "parameters": [ + { + "name": "callback", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ContextCallback", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextCallback" + } + }, + "kindString": "Parameter" + }, + { + "name": "subscribe", + "flags": { + "isOptional": true + }, + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.addCallback" + }, + "kindString": "Call signature" + } + ], + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.addCallback" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.addCallback" + } + }, + { + "name": "clearCallbacks", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 64, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "clearCallbacks", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 64 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.clearCallbacks" + }, + "kindString": "Call signature" + } + ], + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.clearCallbacks" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.clearCallbacks" + } + }, + { + "name": "hostConnected", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 100, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "hostConnected", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 100 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostConnected" + }, + "kindString": "Call signature" + } + ], + "implementationOf": { + "type": "reference", + "name": "ReactiveController.hostConnected" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.hostConnected" + } + }, + { + "name": "onContextRequest", + "flags": { + "isPublic": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 80, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "onContextRequest", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 80 + } + ], + "parameters": [ + { + "name": "ev", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + } + ], + "name": "ContextRequestEvent", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextRequestEvent" + } + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "kindString": "Call signature" + } + ], + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.onContextRequest" + } + }, + { + "name": "setValue", + "flags": { + "isPublic": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 33, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "setValue", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 33 + } + ], + "parameters": [ + { + "name": "v", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "kindString": "Parameter" + }, + { + "name": "force", + "type": { + "type": "intrinsic", + "name": "boolean" + }, + "defaultValue": "false", + "kindString": "Parameter" + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.setValue" + }, + "kindString": "Call signature" + } + ], + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.setValue" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.setValue" + } + }, + { + "name": "updateObservers", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/value-notifier.ts", + "line": 47, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "updateObservers", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/value-notifier.ts", + "line": 47 + } + ], + "type": { + "type": "intrinsic", + "name": "void" + }, + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.updateObservers" + }, + "kindString": "Call signature" + } + ], + "inheritedFrom": { + "type": "reference", + "name": "ValueNotifier.updateObservers" + }, + "kindString": "Method", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider.updateObservers" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 50, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "T", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "extendedTypes": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ValueNotifier", + "package": "@lit-labs/context" + } + ], + "implementedTypes": [ + { + "type": "reference", + "name": "ReactiveController", + "package": "@lit/reactive-element" + } + ], + "kindString": "Class", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProvider" + }, + "heritage": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "T" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ], + "name": "ValueNotifier", + "package": "@lit-labs/context" + } + ] + }, + { + "name": "ContextProviderEvent", + "children": [ + { + "name": "constructor", + "flags": { + "isPublic": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 29, + "moduleSpecifier": "@lit-labs/context" + } + ], + "signatures": [ + { + "name": "new ContextProviderEvent", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 29 + } + ], + "typeParameter": [ + { + "name": "C", + "type": { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "intrinsic", + "name": "unknown" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + }, + "kindString": "Type parameter" + } + ], + "parameters": [ + { + "name": "context", + "comment": { + "shortText": "the context which this provider can provide" + }, + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextProviderEvent", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextProviderEvent" + } + }, + "overwrites": { + "type": "reference", + "name": "Event.constructor" + }, + "kindString": "Constructor signature" + } + ], + "overwrites": { + "type": "reference", + "name": "Event.constructor" + }, + "kindString": "Constructor", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProviderEvent.constructor" + } + }, + { + "name": "context", + "flags": { + "isPublic": true, + "isReadonly": true + }, + "comment": { + "shortText": "the context which this provider can provide" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 29, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProviderEvent.context" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 22, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "extendedTypes": [ + { + "type": "reference", + "name": "Event", + "package": "typescript" + } + ], + "kindString": "Class", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextProviderEvent" + }, + "heritage": [ + { + "type": "reference", + "name": "Event", + "package": "typescript" + } + ] + }, + { + "name": "Options", + "children": [ + { + "name": "context", + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 38, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "name": "C" + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options.context" + } + }, + { + "name": "initialValue", + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 39, + "moduleSpecifier": "@lit-labs/context" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "C" + } + ], + "name": "ContextType", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "ContextType" + } + }, + "kindString": "Property", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options.initialValue" + } + } + ], + "sources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 37, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "C", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "kindString": "Interface", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/controllers/context-provider.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Options" + } + }, + { + "name": "Context", + "comment": { + "shortText": "The Context type defines a type brand to associate a key value with the context value type" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 10, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "KeyType", + "kindString": "Type parameter" + }, + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "type": { + "type": "intersection", + "types": [ + { + "type": "reference", + "name": "KeyType" + }, + { + "type": "reflection", + "declaration": { + "name": "__type", + "children": [ + { + "name": "__context__", + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "type": { + "type": "reference", + "name": "ValueType" + }, + "kindString": "Property" + } + ], + "sources": [ + { + "fileName": "packages/lit-dev-api/api-data/lit-2/repo/packages/labs/context/src/lib/create-context.ts", + "line": 10 + } + ], + "kindString": "Type literal" + } + } + ] + }, + "kindString": "Type alias", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "Context" + } + }, + { + "name": "ContextKey", + "comment": { + "blockTags": [ + { + "tag": "@deprecated", + "content": [ + { + "text": "use Context instead" + } + ] + } + ] + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 15, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "KeyType", + "kindString": "Type parameter" + }, + { + "name": "ValueType", + "kindString": "Type parameter" + } + ], + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "reference", + "name": "KeyType" + }, + { + "type": "reference", + "name": "ValueType" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type alias", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextKey" + } + }, + { + "name": "ContextType", + "comment": { + "shortText": "A helper type which can extract a Context value type from a Context type" + }, + "sources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 20, + "moduleSpecifier": "@lit-labs/context" + } + ], + "typeParameters": [ + { + "name": "Key", + "type": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "intrinsic", + "name": "unknown" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "kindString": "Type parameter" + } + ], + "type": { + "type": "conditional", + "checkType": { + "type": "reference", + "name": "Key" + }, + "extendsType": { + "type": "reference", + "typeArguments": [ + { + "type": "intrinsic", + "name": "unknown" + }, + { + "type": "inferred", + "name": "ValueType" + } + ], + "name": "Context", + "package": "@lit-labs/context", + "location": { + "page": "context", + "anchor": "Context" + } + }, + "trueType": { + "type": "reference", + "name": "ValueType" + }, + "falseType": { + "type": "intrinsic", + "name": "never" + } + }, + "kindString": "Type alias", + "entrypointSources": [ + { + "fileName": "packages/labs/context/src/lib/create-context.ts", + "line": 1, + "moduleSpecifier": "@lit-labs/context" + } + ], + "location": { + "page": "context", + "anchor": "ContextType" + } + } + ] } ] \ No newline at end of file diff --git a/packages/lit-dev-api/api-data/lit-2/symbols.json b/packages/lit-dev-api/api-data/lit-2/symbols.json index 8691d99bc..2c0b26b0f 100644 --- a/packages/lit-dev-api/api-data/lit-2/symbols.json +++ b/packages/lit-dev-api/api-data/lit-2/symbols.json @@ -7,112 +7,24 @@ ], "$constructor": [ { - "page": "custom-directives", - "anchor": "AsyncDirective.constructor" - }, - { - "page": "custom-directives", - "anchor": "AttributePart.constructor" + "page": "context", + "anchor": "ContextRoot.constructor" }, { - "page": "custom-directives", - "anchor": "BooleanAttributePart.constructor" + "page": "context", + "anchor": "ContextRequestEvent.constructor" }, { - "page": "custom-directives", - "anchor": "ChildPart.constructor" + "page": "context", + "anchor": "ContextConsumer.constructor" }, { - "page": "custom-directives", - "anchor": "Directive.constructor" + "page": "context", + "anchor": "ContextProvider.constructor" }, { - "page": "custom-directives", - "anchor": "ElementPart.constructor" - }, - { - "page": "custom-directives", - "anchor": "EventPart.constructor" - }, - { - "page": "custom-directives", - "anchor": "PropertyPart.constructor" - }, - { - "page": "custom-directives", - "anchor": "DirectiveClass.constructor" - }, - { - "page": "directives", - "anchor": "AsyncAppendDirective.constructor" - }, - { - "page": "directives", - "anchor": "AsyncReplaceDirective.constructor" - }, - { - "page": "directives", - "anchor": "CacheDirective.constructor" - }, - { - "page": "directives", - "anchor": "ClassMapDirective.constructor" - }, - { - "page": "directives", - "anchor": "GuardDirective.constructor" - }, - { - "page": "directives", - "anchor": "Keyed.constructor" - }, - { - "page": "directives", - "anchor": "LiveDirective.constructor" - }, - { - "page": "directives", - "anchor": "Ref.constructor" - }, - { - "page": "directives", - "anchor": "RefDirective.constructor" - }, - { - "page": "directives", - "anchor": "RepeatDirective.constructor" - }, - { - "page": "directives", - "anchor": "StyleMapDirective.constructor" - }, - { - "page": "directives", - "anchor": "TemplateContentDirective.constructor" - }, - { - "page": "directives", - "anchor": "UnsafeHTMLDirective.constructor" - }, - { - "page": "directives", - "anchor": "UnsafeSVGDirective.constructor" - }, - { - "page": "directives", - "anchor": "UntilDirective.constructor" - }, - { - "page": "LitElement", - "anchor": "LitElement.constructor" - }, - { - "page": "ReactiveElement", - "anchor": "ReactiveElement.constructor" - }, - { - "page": "misc", - "anchor": "TemplateInstance.constructor" + "page": "context", + "anchor": "ContextProviderEvent.constructor" } ], "$AsyncDirective.constructor": [ @@ -291,24 +203,8 @@ ], "$setValue": [ { - "page": "custom-directives", - "anchor": "AsyncDirective.setValue" - }, - { - "page": "directives", - "anchor": "AsyncAppendDirective.setValue" - }, - { - "page": "directives", - "anchor": "AsyncReplaceDirective.setValue" - }, - { - "page": "directives", - "anchor": "RefDirective.setValue" - }, - { - "page": "directives", - "anchor": "UntilDirective.setValue" + "page": "context", + "anchor": "ContextProvider.setValue" } ], "$AsyncDirective.setValue": [ @@ -1646,48 +1542,12 @@ ], "$value": [ { - "page": "directives", - "anchor": "Ref.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.BeginRender.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitAttribute.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitBooleanAttribute.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitEventListener.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitNode.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitProperty.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitText.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.CommitToElementBinding.value" + "page": "context", + "anchor": "ContextConsumer.value" }, { - "page": "misc", - "anchor": "LitUnstable.DebugLog.EndRender.value" - }, - { - "page": "misc", - "anchor": "LitUnstable.DebugLog.SetPartValue.value" + "page": "context", + "anchor": "ContextProvider.value" } ], "$Ref.value": [ @@ -4238,8 +4098,12 @@ ], "$hostConnected": [ { - "page": "controllers", - "anchor": "ReactiveController.hostConnected" + "page": "context", + "anchor": "ContextConsumer.hostConnected" + }, + { + "page": "context", + "anchor": "ContextProvider.hostConnected" } ], "$ReactiveController.hostConnected": [ @@ -4250,8 +4114,8 @@ ], "$hostDisconnected": [ { - "page": "controllers", - "anchor": "ReactiveController.hostDisconnected" + "page": "context", + "anchor": "ContextConsumer.hostDisconnected" } ], "$ReactiveController.hostDisconnected": [ @@ -4334,8 +4198,12 @@ ], "$host": [ { - "page": "LitElement", - "anchor": "RenderOptions.host" + "page": "context", + "anchor": "ContextConsumer.host" + }, + { + "page": "context", + "anchor": "ContextProvider.host" } ], "$RenderOptions.host": [ @@ -4597,5 +4465,381 @@ "page": "static-html", "anchor": "withStatic" } + ], + "$ContextRoot": [ + { + "page": "context", + "anchor": "ContextRoot" + } + ], + "$ContextRoot.constructor": [ + { + "page": "context", + "anchor": "ContextRoot.constructor" + } + ], + "$attach": [ + { + "page": "context", + "anchor": "ContextRoot.attach" + } + ], + "$ContextRoot.attach": [ + { + "page": "context", + "anchor": "ContextRoot.attach" + } + ], + "$detach": [ + { + "page": "context", + "anchor": "ContextRoot.detach" + } + ], + "$ContextRoot.detach": [ + { + "page": "context", + "anchor": "ContextRoot.detach" + } + ], + "$contextProvided": [ + { + "page": "context", + "anchor": "contextProvided" + } + ], + "$contextProvider": [ + { + "page": "context", + "anchor": "contextProvider" + } + ], + "$ContextRequestEvent": [ + { + "page": "context", + "anchor": "ContextRequestEvent" + } + ], + "$ContextRequestEvent.constructor": [ + { + "page": "context", + "anchor": "ContextRequestEvent.constructor" + } + ], + "$callback": [ + { + "page": "context", + "anchor": "ContextRequestEvent.callback" + }, + { + "page": "context", + "anchor": "ContextRequest.callback" + }, + { + "page": "context", + "anchor": "Options.callback" + } + ], + "$ContextRequestEvent.callback": [ + { + "page": "context", + "anchor": "ContextRequestEvent.callback" + } + ], + "$context": [ + { + "page": "context", + "anchor": "ContextRequestEvent.context" + }, + { + "page": "context", + "anchor": "ContextRequest.context" + }, + { + "page": "context", + "anchor": "Options.context" + }, + { + "page": "context", + "anchor": "ContextProviderEvent.context" + }, + { + "page": "context", + "anchor": "Options.context" + } + ], + "$ContextRequestEvent.context": [ + { + "page": "context", + "anchor": "ContextRequestEvent.context" + } + ], + "$subscribe": [ + { + "page": "context", + "anchor": "ContextRequestEvent.subscribe" + }, + { + "page": "context", + "anchor": "ContextRequest.subscribe" + }, + { + "page": "context", + "anchor": "Options.subscribe" + } + ], + "$ContextRequestEvent.subscribe": [ + { + "page": "context", + "anchor": "ContextRequestEvent.subscribe" + } + ], + "$ContextRequest": [ + { + "page": "context", + "anchor": "ContextRequest" + } + ], + "$ContextRequest.callback": [ + { + "page": "context", + "anchor": "ContextRequest.callback" + } + ], + "$ContextRequest.context": [ + { + "page": "context", + "anchor": "ContextRequest.context" + } + ], + "$ContextRequest.subscribe": [ + { + "page": "context", + "anchor": "ContextRequest.subscribe" + } + ], + "$ContextCallback": [ + { + "page": "context", + "anchor": "ContextCallback" + } + ], + "$ContextConsumer": [ + { + "page": "context", + "anchor": "ContextConsumer" + } + ], + "$ContextConsumer.constructor": [ + { + "page": "context", + "anchor": "ContextConsumer.constructor" + } + ], + "$ContextConsumer.host": [ + { + "page": "context", + "anchor": "ContextConsumer.host" + } + ], + "$ContextConsumer.value": [ + { + "page": "context", + "anchor": "ContextConsumer.value" + } + ], + "$ContextConsumer.hostConnected": [ + { + "page": "context", + "anchor": "ContextConsumer.hostConnected" + } + ], + "$ContextConsumer.hostDisconnected": [ + { + "page": "context", + "anchor": "ContextConsumer.hostDisconnected" + } + ], + "$Options": [ + { + "page": "context", + "anchor": "Options" + }, + { + "page": "context", + "anchor": "Options" + } + ], + "$Options.callback": [ + { + "page": "context", + "anchor": "Options.callback" + } + ], + "$Options.context": [ + { + "page": "context", + "anchor": "Options.context" + }, + { + "page": "context", + "anchor": "Options.context" + } + ], + "$Options.subscribe": [ + { + "page": "context", + "anchor": "Options.subscribe" + } + ], + "$ContextProvider": [ + { + "page": "context", + "anchor": "ContextProvider" + } + ], + "$ContextProvider.constructor": [ + { + "page": "context", + "anchor": "ContextProvider.constructor" + } + ], + "$ContextProvider.host": [ + { + "page": "context", + "anchor": "ContextProvider.host" + } + ], + "$ContextProvider.value": [ + { + "page": "context", + "anchor": "ContextProvider.value" + } + ], + "$addCallback": [ + { + "page": "context", + "anchor": "ContextProvider.addCallback" + } + ], + "$ContextProvider.addCallback": [ + { + "page": "context", + "anchor": "ContextProvider.addCallback" + } + ], + "$clearCallbacks": [ + { + "page": "context", + "anchor": "ContextProvider.clearCallbacks" + } + ], + "$ContextProvider.clearCallbacks": [ + { + "page": "context", + "anchor": "ContextProvider.clearCallbacks" + } + ], + "$ContextProvider.hostConnected": [ + { + "page": "context", + "anchor": "ContextProvider.hostConnected" + } + ], + "$onContextRequest": [ + { + "page": "context", + "anchor": "ContextProvider.onContextRequest" + } + ], + "$ContextProvider.onContextRequest": [ + { + "page": "context", + "anchor": "ContextProvider.onContextRequest" + } + ], + "$ContextProvider.setValue": [ + { + "page": "context", + "anchor": "ContextProvider.setValue" + } + ], + "$updateObservers": [ + { + "page": "context", + "anchor": "ContextProvider.updateObservers" + } + ], + "$ContextProvider.updateObservers": [ + { + "page": "context", + "anchor": "ContextProvider.updateObservers" + } + ], + "$ContextProviderEvent": [ + { + "page": "context", + "anchor": "ContextProviderEvent" + } + ], + "$ContextProviderEvent.constructor": [ + { + "page": "context", + "anchor": "ContextProviderEvent.constructor" + } + ], + "$ContextProviderEvent.context": [ + { + "page": "context", + "anchor": "ContextProviderEvent.context" + } + ], + "$initialValue": [ + { + "page": "context", + "anchor": "Options.initialValue" + } + ], + "$Options.initialValue": [ + { + "page": "context", + "anchor": "Options.initialValue" + } + ], + "$Context": [ + { + "page": "context", + "anchor": "Context" + } + ], + "$ContextKey": [ + { + "page": "context", + "anchor": "ContextKey" + } + ], + "$ContextType": [ + { + "page": "context", + "anchor": "ContextType" + } + ], + "$createContext": [ + { + "page": "context", + "anchor": "createContext" + } + ], + "$consume": [ + { + "page": "context", + "anchor": "consume" + } + ], + "$provide": [ + { + "page": "context", + "anchor": "provide" + } ] } \ No newline at end of file diff --git a/packages/lit-dev-content/site/_includes/api.html b/packages/lit-dev-content/site/_includes/api.html index ff535bbd0..a63d03cfb 100644 --- a/packages/lit-dev-content/site/_includes/api.html +++ b/packages/lit-dev-content/site/_includes/api.html @@ -75,6 +75,12 @@ {{- pipe() -}} {{- type(item) -}} {%- endfor -%} + {%- elif t.type == 'intersection' -%} + {%- set pipe = joiner(' & ') -%} + {%- for item in t.types -%} + {{- pipe() -}} {{- type(item) -}} + {%- endfor -%} + {%- elif t.type === 'indexedAccess' -%} {{- type(t.objectType) }}[{{ type(t.indexType) }}] diff --git a/packages/lit-dev-content/site/_includes/docs-nav-collapsing.html b/packages/lit-dev-content/site/_includes/docs-nav-collapsing.html index c1c5c6a65..95c790791 100644 --- a/packages/lit-dev-content/site/_includes/docs-nav-collapsing.html +++ b/packages/lit-dev-content/site/_includes/docs-nav-collapsing.html @@ -28,7 +28,7 @@ {{ child.title }} - {% if child.labs == true %} + {% if child.labs == true or child.labs == "true" %} labs {% endif %} diff --git a/packages/lit-dev-content/site/_includes/docs-nav.html b/packages/lit-dev-content/site/_includes/docs-nav.html index e0b282172..a2923ecf7 100644 --- a/packages/lit-dev-content/site/_includes/docs-nav.html +++ b/packages/lit-dev-content/site/_includes/docs-nav.html @@ -39,7 +39,7 @@ {{ child.title }} - {% if child.labs == true %} + {% if child.labs == true or child.labs == "true" %} labs {% endif %} diff --git a/packages/lit-dev-content/site/docs/api/api.html b/packages/lit-dev-content/site/docs/api/api.html index 11299de03..3f1b1747d 100644 --- a/packages/lit-dev-content/site/docs/api/api.html +++ b/packages/lit-dev-content/site/docs/api/api.html @@ -13,6 +13,7 @@ title: "{{ data.title }}" eleventyNavigation: key: "{{ data.title }}" + labs: "{{ data.labs }}" parent: API apiPath: /docs/api --- diff --git a/packages/lit-dev-tests/src/check-no-todos.ts b/packages/lit-dev-tests/src/check-no-todos.ts index 59e1139f5..55555a0e0 100644 --- a/packages/lit-dev-tests/src/check-no-todos.ts +++ b/packages/lit-dev-tests/src/check-no-todos.ts @@ -41,6 +41,8 @@ const api_pages_to_check = [ pathLib.resolve(siteOutputDir, 'docs/api/static-html/index.html'), pathLib.resolve(siteOutputDir, 'docs/api/styles/index.html'), pathLib.resolve(siteOutputDir, 'docs/api/templates/index.html'), + // @lit-labs/context + pathLib.resolve(siteOutputDir, 'docs/api/context/index.html'), ]; const checkNoTodos = async () => { diff --git a/packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts b/packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts index ba8366961..c95ec7a63 100644 --- a/packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts +++ b/packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts @@ -16,6 +16,9 @@ const gitDir = pathlib.join(workDir, 'repo'); const litDir = pathlib.join(gitDir, 'packages', 'lit'); const srcDir = pathlib.join(litDir, 'src'); +const contextDir = pathlib.join(gitDir, 'packages', 'labs', 'context'); +const contextSrcDir = pathlib.join(contextDir, 'src'); + /** * lit.dev API docs configuration for Lit 2.x */ @@ -24,7 +27,6 @@ export const lit2Config: ApiDocsConfig = { commit: 'c134604f178e36444261d83eabe9e578c1ed90c4', workDir, gitDir, - tsConfigPath: pathlib.join(litDir, 'tsconfig.json'), pagesOutPath: pathlib.resolve(workDir, 'pages.json'), symbolsOutPath: pathlib.resolve(workDir, 'symbols.json'), typedocRoot: pathlib.join(root, 'packages'), @@ -36,24 +38,51 @@ export const lit2Config: ApiDocsConfig = { }, ], - entrypointModules: [ - pathlib.join(srcDir, 'async-directive.ts'), - pathlib.join(srcDir, 'decorators.ts'), - pathlib.join(srcDir, 'directives/'), // Entire directory - pathlib.join(srcDir, 'directive.ts'), - pathlib.join(srcDir, 'directive-helpers.ts'), - // Don't include html.ts because it is already re-exported by index.ts. - // pathlib.join(srcDir, 'html.ts'), - // Don't include hydration because it's not ready yet. - // pathlib.join(srcDir, 'hydrate.ts'), - // pathlib.join(srcDir, 'hydrate-support.ts'), - pathlib.join(srcDir, 'index.ts'), - // Don't include polyfill-support.ts because it doesn't export anything. - // pathlib.join(srcDir, 'polyfill-support.ts'), - pathlib.join(srcDir, 'static-html.ts'), + packages: [ + // 'lit' module documentation + { + tsConfigPath: pathlib.join(litDir, 'tsconfig.json'), + + entrypointModules: [ + pathlib.join(srcDir, 'async-directive.ts'), + pathlib.join(srcDir, 'decorators.ts'), + pathlib.join(srcDir, 'directives/*'), // Entire directory + pathlib.join(srcDir, 'directive.ts'), + pathlib.join(srcDir, 'directive-helpers.ts'), + // Don't include html.ts because it is already re-exported by index.ts. + // pathlib.join(srcDir, 'html.ts'), + // Don't include hydration because it's not ready yet. + // pathlib.join(srcDir, 'hydrate.ts'), + // pathlib.join(srcDir, 'hydrate-support.ts'), + pathlib.join(srcDir, 'index.ts'), + // Don't include polyfill-support.ts because it doesn't export anything. + // pathlib.join(srcDir, 'polyfill-support.ts'), + pathlib.join(srcDir, 'static-html.ts'), + ], + }, + // @lit-labs/context documentation + { + tsConfigPath: pathlib.join(contextDir, 'tsconfig.json'), + entrypointModules: [ + pathlib.join(contextSrcDir, 'index.ts'), + pathlib.join(contextSrcDir, 'lib/context-request-event.ts'), + pathlib.join(contextSrcDir, 'lib/create-context.ts'), + pathlib.join(contextSrcDir, 'lib/controllers/context-consumer.ts'), + pathlib.join(contextSrcDir, 'lib/controllers/context-provider.ts'), + pathlib.join(contextSrcDir, 'lib/decorators/provide.ts'), + pathlib.join(contextSrcDir, 'lib/decorators/consume.ts'), + ], + }, ], - symbolOrder: ['LitElement', 'ReactiveElement'], + symbolOrder: [ + 'LitElement', + 'ReactiveElement', + /** @lit-labs/context symbol ordering */ + 'createContext', + 'consume', + 'provide', + ], pages: [ { @@ -127,6 +156,12 @@ export const lit2Config: ApiDocsConfig = { v1: 'api/lit-element/LitElement/', }, }, + // Add @lit-labs/context page. + { + slug: 'context', + title: 'Context', + labs: true, + }, ], pageForSymbol(node): string { @@ -139,6 +174,10 @@ export const lit2Config: ApiDocsConfig = { return 'decorators'; } + if (entrypoint.includes('/context/')) { + return 'context'; + } + if ( entrypoint.endsWith('/directive.ts') || entrypoint.endsWith('/directive-helpers.ts') || @@ -225,6 +264,14 @@ export const lit2Config: ApiDocsConfig = { // fine in practice, but when we add e.g. @lit/localize we'll need to be // smarter here. let [_, pkg, pathMinusExtension] = match; + + if (pkg === 'labs/context') { + console.log(pkg, pathMinusExtension); + // There are no @lit-labs/context path extensions because everything is + // re-exported from root. + return '@lit-labs/context'; + } + // TODO(aomarks) This wrongly assumes index.ts is always the package main. return pathMinusExtension === 'index' ? pkg diff --git a/packages/lit-dev-tools-cjs/src/api-docs/generate.ts b/packages/lit-dev-tools-cjs/src/api-docs/generate.ts index b99f4892e..99be88034 100644 --- a/packages/lit-dev-tools-cjs/src/api-docs/generate.ts +++ b/packages/lit-dev-tools-cjs/src/api-docs/generate.ts @@ -9,7 +9,7 @@ import * as fs from 'fs/promises'; import * as pathlib from 'path'; import {execFile} from 'child_process'; import {promisify} from 'util'; -import {ApiDocsTransformer} from './transformer.js'; +import {ApiDocsTransformer, Pages, SymbolMap} from './transformer.js'; import {lit2Config} from './configs/lit-2.js'; import type {ApiDocsConfig} from './types.js'; @@ -89,29 +89,34 @@ const analyze = async (config: ApiDocsConfig) => { } console.log(`Analyzing ${config.gitDir}`); - const app = new typedoc.Application(); - app.options.addReader(new typedoc.TSConfigReader()); - app.bootstrap({ - tsconfig: config.tsConfigPath, - entryPoints: config.entrypointModules, - entryPointStrategy: typedoc.EntryPointStrategy.Expand, - }); - const root = app.convert(); - if (!root) { - throw new Error('TypeDoc.Application.convert() returned undefined'); - } + const allPages: Pages = []; + const allSymbols: SymbolMap = {}; + for (const pkg of config.packages) { + const app = new typedoc.Application(); + app.options.addReader(new typedoc.TSConfigReader()); + app.bootstrap({ + tsconfig: pkg.tsConfigPath, + entryPoints: pkg.entrypointModules, + }); + const root = app.convert(); + if (!root) { + throw new Error('TypeDoc.Application.convert() returned undefined'); + } - const json = await app.serializer.projectToObject( - root, - pathlib.resolve(config.tsConfigPath, '..') - ); - const transformer = new ApiDocsTransformer(json, config); - const {pages, symbolMap} = await transformer.transform(); + const json = app.serializer.projectToObject( + root, + pathlib.resolve(pkg.tsConfigPath, '..') + ); + const transformer = new ApiDocsTransformer(json, config); + const {pages, symbolMap} = await transformer.transform(); + allPages.push(...pages); + Object.assign(allSymbols, symbolMap); + } await fs.mkdir(pathlib.dirname(config.pagesOutPath), {recursive: true}); await fs.writeFile( config.pagesOutPath, - JSON.stringify(pages, null, 2), + JSON.stringify(allPages, null, 2), 'utf8' ); console.log(`Wrote ${config.pagesOutPath}`); @@ -119,7 +124,7 @@ const analyze = async (config: ApiDocsConfig) => { await fs.mkdir(pathlib.dirname(config.symbolsOutPath), {recursive: true}); await fs.writeFile( config.symbolsOutPath, - JSON.stringify(symbolMap, null, 2), + JSON.stringify(allSymbols, null, 2), 'utf8' ); console.log(`Wrote ${config.symbolsOutPath}`); diff --git a/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts b/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts index 7b508e48c..f37527b3e 100644 --- a/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts +++ b/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts @@ -66,7 +66,7 @@ const symbolToExternalLink = new Map([ * Data consumed by lit.dev API docs Eleventy template. Each item is a separate * page. */ -type Pages = Array<{ +export type Pages = Array<{ slug: string; title: string; items: Array; @@ -76,7 +76,7 @@ type Pages = Array<{ * Map from $symbol to the location it appears in our docs. If there is more * than one item, then the symbol is ambiguous. */ -type SymbolMap = { +export type SymbolMap = { [symbol: string]: Array; }; @@ -120,6 +120,7 @@ export class ApiDocsTransformer { // to copy our original entrypoint source info to each node. (node as ExtendedDeclarationReflection).entrypointSources = entrypoint.sources; + this.addKindStringToNodes(node); for (const source of node.sources ?? []) { this.makeSourceRelativeToMonorepoRoot(source); await this.updateSourceFromDtsToTs(source); @@ -579,9 +580,6 @@ export class ApiDocsTransformer { const bEntrypoint = (b as ExtendedDeclarationReflection).entrypointSources?.[0]?.fileName ?? ''; - if (aEntrypoint !== bEntrypoint) { - return aEntrypoint.localeCompare(bEntrypoint); - } // Hard-coded orderings const idxA = findIndexOrInfinity( @@ -594,10 +592,16 @@ export class ApiDocsTransformer { (s) => s === (b as ExtendedDeclarationReflection).location?.anchor ?? b.name ); - if (idxA !== idxB) { + + // Return an order if at least one of the symbols is hard coded. + if (idxA !== idxB && !(idxA === Infinity && idxB === Infinity)) { return idxA - idxB; } + if (aEntrypoint !== bEntrypoint) { + return aEntrypoint.localeCompare(bEntrypoint); + } + // Types after values if (isType(a) && !isType(b)) { return 1; @@ -689,6 +693,13 @@ export class ApiDocsTransformer { commentNode.summary = undefined; } + private addKindStringToNodes(node: DeclarationReflection) { + if (node.kind) { + (node as ExtendedDeclarationReflection).kindString = + typedoc.ReflectionKind.singularString(node.kind); + } + } + /** * TypeDoc 0.24.x removed `kindString` from their data structure. However we * use `kindString` to locate and generate correct documentation within diff --git a/packages/lit-dev-tools-cjs/src/api-docs/types.ts b/packages/lit-dev-tools-cjs/src/api-docs/types.ts index 1f4d0afcc..12dbaf4aa 100644 --- a/packages/lit-dev-tools-cjs/src/api-docs/types.ts +++ b/packages/lit-dev-tools-cjs/src/api-docs/types.ts @@ -57,6 +57,30 @@ export interface Location { excludeFromTOC?: boolean; } +/** + * A package, such as `lit` or `@lit-labs/context`. + */ +export interface Package { + /** + * Path to the tsconfig.json that owns the entrypoint modules. + */ + tsConfigPath: string; + + /** + * Entrypoint TypeScript modules for TypeDoc to analyze. + * + * The modules listed here should be the preferred modules that users should + * import from, because import statements will be generated using these + * entrypoints as the module specifier (e.g. `import {LitElement} from + * 'lit'`). GitHub source links will be generated pointing at the ultimate + * location where the symbol is concretely defined (e.g. + * `packages/lit-element/src/lit-element.ts`). + * + * If a directory, all .ts files within it are included. + */ + entrypointModules: Array; +} + export interface ApiDocsConfig { /** * Git repo remote URL. @@ -78,37 +102,20 @@ export interface ApiDocsConfig { */ gitDir: string; - /** - * Path to the tsconfig.json that owns the entrypoint modules. - */ - tsConfigPath: string; - /** * The directory that TypeDoc chooses as the root of this package. Unclear why * this is unpredictable. */ typedocRoot: string; + packages: Package[]; + /** * Extra setup/build commands to run after NPM install and before running * TypeDoc. */ extraSetupCommands?: Array<{cmd: string; args: string[]}>; - /** - * Entrypoint TypeScript modules for TypeDoc to analyze. - * - * The modules listed here should be the preferred modules that users should - * import from, because import statements will be generated using these - * entrypoints as the module specifier (e.g. `import {LitElement} from - * 'lit'`). GitHub source links will be generated pointing at the ultimate - * location where the symbol is concretely defined (e.g. - * `packages/lit-element/src/lit-element.ts`). - * - * If a directory, all .ts files within it are included. - */ - entrypointModules: string[]; - /** * Where to write the API data that is consumed by our Eleventy template. */ @@ -134,6 +141,7 @@ export interface ApiDocsConfig { title: string; tocFilter?: (node: DeclarationReflection) => boolean; versionLinks?: {[version: string]: string}; + labs?: true; }>; /**