Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lit-labs/ssr

Package Overview
Dependencies
Maintainers
11
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-labs/ssr - npm Package Compare versions

Comparing version 3.1.3-pre.0 to 3.1.3

8

lib/element-renderer.d.ts
/// <reference lib="dom" />
import type { RenderInfo } from './render-value.js';
import type { RenderResult } from './render-result.js';
type Interface<T> = {
declare type Interface<T> = {
[P in keyof T]: T[P];
};
export type ElementRendererConstructor = (new (tagName: string) => Interface<ElementRenderer>) & typeof ElementRenderer;
type AttributesMap = Map<string, string>;
export declare type ElementRendererConstructor = (new (tagName: string) => Interface<ElementRenderer>) & typeof ElementRenderer;
declare type AttributesMap = Map<string, string>;
export declare const getElementRenderer: ({ elementRenderers }: RenderInfo, tagName: string, ceClass?: typeof HTMLElement | undefined, attributes?: AttributesMap) => ElementRenderer;

@@ -13,3 +13,3 @@ /**

*/
export type ShadowRootOptions = ShadowRootInit;
export declare type ShadowRootOptions = ShadowRootInit;
/**

@@ -16,0 +16,0 @@ * An object that renders elements of a certain type.

@@ -30,2 +30,11 @@ /// <reference lib="dom" />

/**
* Called when a custom element is instantiated during a server render.
*
* An ElementRenderer can actually instantiate the custom element class, or
* it could emulate the element in some other way.
*/
constructor(tagName) {
this.tagName = tagName;
}
/**
* Should be implemented to return true when the given custom element class

@@ -43,11 +52,2 @@ * and/or tagName should be handled by this renderer.

/**
* Called when a custom element is instantiated during a server render.
*
* An ElementRenderer can actually instantiate the custom element class, or
* it could emulate the element in some other way.
*/
constructor(tagName) {
this.tagName = tagName;
}
/**
* Called when a custom element is "attached" to the server DOM.

@@ -54,0 +54,0 @@ *

@@ -10,3 +10,3 @@ /**

import type { RenderResult } from './render-result.js';
export type Constructor<T> = {
export declare type Constructor<T> = {
new (): T;

@@ -13,0 +13,0 @@ };

@@ -16,6 +16,2 @@ /**

export class LitElementRenderer extends ElementRenderer {
static matchesClass(ctor) {
// This property needs to remain unminified.
return ctor['_$litElement$'];
}
constructor(tagName) {

@@ -40,2 +36,6 @@ super(tagName);

}
static matchesClass(ctor) {
// This property needs to remain unminified.
return ctor['_$litElement$'];
}
get shadowRootOptions() {

@@ -42,0 +42,0 @@ return (this.element.constructor.shadowRootOptions ??

@@ -111,3 +111,3 @@ /**

*/
class ModuleLoader {
export class ModuleLoader {
// TODO (justinfagnani): Allow passing a filesystem object to allow network

@@ -253,3 +253,2 @@ // sources, in-memory for tests, etc.

ModuleLoader._nextVmContextId = 0;
export { ModuleLoader };
/**

@@ -256,0 +255,0 @@ * Resolves specifiers using web-ish Node module resolution. Web-compatible full

@@ -18,3 +18,3 @@ /**

*/
export type RenderInfo = _RenderInfo;
export declare type RenderInfo = _RenderInfo;
/**

@@ -24,3 +24,3 @@ * @deprecated Ability to import from `@lit-labs/ssr/lib/render-lit-html.js`

*/
export type RenderResult = _RenderResult;
export declare type RenderResult = _RenderResult;
//# sourceMappingURL=render-lit-html.d.ts.map

@@ -19,3 +19,3 @@ /**

*/
export type RenderResult = Iterable<string | Promise<RenderResult>>;
export declare type RenderResult = Iterable<string | Promise<RenderResult>>;
/**

@@ -22,0 +22,0 @@ * Joins a RenderResult into a string

@@ -9,3 +9,3 @@ /// <reference lib="dom" />

}
export type RenderInfo = {
export declare type RenderInfo = {
/**

@@ -12,0 +12,0 @@ * Element renderers to use

/// <reference lib="dom" />
import { nothing, noChange } from 'lit';
import { PartType } from 'lit/directive.js';
import { isTemplateResult, getDirectiveClass } from 'lit/directive-helpers.js';
import { isPrimitive, isTemplateResult, getDirectiveClass, } from 'lit/directive-helpers.js';
import { _$LH } from 'lit-html/private-ssr-support.js';
const { getTemplateHtml, marker, markerMatch, boundAttributeSuffix, overrideDirectiveResolve, setDirectiveClass, getAttributePartCommittedValue, resolveDirective, AttributePart, PropertyPart, BooleanAttributePart, EventPart, connectedDisconnectable, } = _$LH;
const { getTemplateHtml, marker, markerMatch, boundAttributeSuffix, overrideDirectiveResolve, setDirectiveClass, getAttributePartCommittedValue, resolveDirective, AttributePart, PropertyPart, BooleanAttributePart, EventPart, connectedDisconnectable, isIterable, } = _$LH;
import { digestForTemplateResult } from '@lit-labs/ssr-client';

@@ -355,3 +355,4 @@ import { getElementRenderer, } from './element-renderer.js';

}
else if (Array.isArray(value)) {
else if (!isPrimitive(value) && isIterable(value)) {
// Check that value is not a primitive, since strings are iterable
for (const item of value) {

@@ -358,0 +359,0 @@ yield* renderValue(item, renderInfo);

{
"name": "@lit-labs/ssr",
"type": "module",
"version": "3.1.3-pre.0",
"version": "3.1.3",
"publishConfig": {

@@ -210,11 +210,11 @@ "access": "public"

"dependencies": {
"@lit-labs/ssr-client": "^1.1.2-pre.0",
"@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
"@lit/reactive-element": "^2.0.0-pre.0",
"@lit-labs/ssr-client": "^1.1.0",
"@lit-labs/ssr-dom-shim": "^1.1.0",
"@lit/reactive-element": "^1.6.0",
"@parse5/tools": "^0.1.0",
"@types/node": "^16.0.0",
"enhanced-resolve": "^5.10.0",
"lit": "^3.0.0-pre.0",
"lit-element": "^4.0.0-pre.0",
"lit-html": "^3.0.0-pre.0",
"lit": "^2.7.0",
"lit-element": "^3.3.0",
"lit-html": "^2.7.0",
"node-fetch": "^3.2.8",

@@ -221,0 +221,0 @@ "parse5": "^7.1.1"

@@ -96,3 +96,3 @@ # @lit-labs/ssr

When `LitElement`s are server rendered, their shadow root contents are emitted inside a `<template shadowroot>`, also known as a [Declarative Shadow Root](https://web.dev/declarative-shadow-dom/), a new browser feature that is shipping [Chrome](https://developer.chrome.com/blog/new-in-chrome-90/#declarative). Declarative shadow roots automatically attach their contents to a shadow root on the template's parent element when parsed. For browsers that do not yet implement declarative shadow root, there is a [`template-shadowroot`](https://github.com/webcomponents/template-shadowroot) polyfill, described below.
When `LitElement`s are server rendered, their shadow root contents are emitted inside a `<template shadowroot>`, also known as a [Declarative Shadow Root](https://web.dev/declarative-shadow-dom/), a new browser feature that is shipping in [most modern browsers](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template#browser_compatibility). Declarative shadow roots automatically attach their contents to a shadow root on the template's parent element when parsed. For browsers that do not yet implement declarative shadow root, there is a [`template-shadowroot`](https://github.com/webcomponents/template-shadowroot) polyfill, described below.

@@ -99,0 +99,0 @@ `hydrate()` does not descend into shadow roots - it only works on one scope of the DOM at a time. To hydrate `LitElement` shadow roots, load the `@lit-labs/ssr-client/lit-element-hydrate-support.js` module, which installs support for `LitElement` to automatically hydrate itself when it detects it was server-rendered with declarative shadow DOM. This module must be loaded before the `lit` module is loaded, to ensure hydration support is properly installed.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc