@solidjs/html 2.0.0-beta.6 → 2.0.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/html.cjs CHANGED
@@ -240,12 +240,12 @@ function createHTML(r, {
240
240
  namespace = parts[0];
241
241
  }
242
242
  const isChildProp = r.ChildProperties.has(name);
243
- const isStatefulDOMProperty = !!r.DOMWithState[node.name.toUpperCase()]?.[name];
243
+ const isLockedDOMProperty = !!r.DOMWithState[node.name.toUpperCase()]?.[name];
244
244
  if (name === "style") {
245
245
  options.exprs.push(`r.style(${tag},${expr},_$p)`);
246
246
  } else if (name === "class") {
247
247
  options.exprs.push(`r.className(${tag},${expr},_$p)`);
248
- } else if (isChildProp || isStatefulDOMProperty || namespace === "prop") {
248
+ } else if (isChildProp || isLockedDOMProperty || namespace === "prop") {
249
249
  options.exprs.push(`${tag}.${name} = ${expr}`);
250
250
  } else {
251
251
  const ns = name.indexOf(":") > -1 && r.Namespaces[name.split(":")[0]];
@@ -554,11 +554,12 @@ const html = createHTML({
554
554
  setAttribute: web.setAttribute,
555
555
  setAttributeNS: web.setAttributeNS,
556
556
  addEventListener: web.addEventListener,
557
- Properties: web.Properties,
557
+ DOMWithState: web.DOMWithState,
558
558
  ChildProperties: web.ChildProperties,
559
559
  DelegatedEvents: web.DelegatedEvents,
560
560
  SVGElements: web.SVGElements,
561
- SVGNamespace: web.SVGNamespace
561
+ MathMLElements: web.MathMLElements,
562
+ Namespaces: web.Namespaces
562
563
  });
563
564
 
564
565
  module.exports = html;
package/dist/html.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SVGNamespace, SVGElements, DelegatedEvents, ChildProperties, Properties, addEventListener, setAttributeNS, setAttribute, dynamicProperty, mergeProps, className, delegateEvents, createComponent, spread, untrack, insert, style, effect } from '@solidjs/web';
1
+ import { Namespaces, MathMLElements, SVGElements, DelegatedEvents, ChildProperties, DOMWithState, addEventListener, setAttributeNS, setAttribute, dynamicProperty, mergeProps, className, delegateEvents, createComponent, spread, untrack, insert, style, effect } from '@solidjs/web';
2
2
 
3
3
  const tagRE = /(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g;
4
4
  const attrRE = /(?:\s(?<boolean>[^/\s><=]+?)(?=[\s/>]))|(?:(?<name>\S+?)(?:\s*=\s*(?:(['"])(?<quotedValue>[\s\S]*?)\3|(?<unquotedValue>[^\s>]+))))/g;
@@ -238,12 +238,12 @@ function createHTML(r, {
238
238
  namespace = parts[0];
239
239
  }
240
240
  const isChildProp = r.ChildProperties.has(name);
241
- const isStatefulDOMProperty = !!r.DOMWithState[node.name.toUpperCase()]?.[name];
241
+ const isLockedDOMProperty = !!r.DOMWithState[node.name.toUpperCase()]?.[name];
242
242
  if (name === "style") {
243
243
  options.exprs.push(`r.style(${tag},${expr},_$p)`);
244
244
  } else if (name === "class") {
245
245
  options.exprs.push(`r.className(${tag},${expr},_$p)`);
246
- } else if (isChildProp || isStatefulDOMProperty || namespace === "prop") {
246
+ } else if (isChildProp || isLockedDOMProperty || namespace === "prop") {
247
247
  options.exprs.push(`${tag}.${name} = ${expr}`);
248
248
  } else {
249
249
  const ns = name.indexOf(":") > -1 && r.Namespaces[name.split(":")[0]];
@@ -552,11 +552,12 @@ const html = createHTML({
552
552
  setAttribute,
553
553
  setAttributeNS,
554
554
  addEventListener,
555
- Properties,
555
+ DOMWithState,
556
556
  ChildProperties,
557
557
  DelegatedEvents,
558
558
  SVGElements,
559
- SVGNamespace
559
+ MathMLElements,
560
+ Namespaces
560
561
  });
561
562
 
562
563
  export { html as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/html",
3
3
  "description": "Build-less Tagged-Template-Literal Templating for Solid",
4
- "version": "2.0.0-beta.6",
4
+ "version": "2.0.0-beta.7",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -20,28 +20,34 @@
20
20
  "files": [
21
21
  "dist",
22
22
  "types",
23
+ "types-cjs",
23
24
  "package.json"
24
25
  ],
25
26
  "exports": {
26
27
  ".": {
27
- "types": "./types/index.d.ts",
28
- "import": "./dist/html.js",
29
- "require": "./dist/html.cjs"
30
- },
31
- "./dist/*": "./dist/*"
28
+ "import": {
29
+ "types": "./types/index.d.ts",
30
+ "default": "./dist/html.js"
31
+ },
32
+ "require": {
33
+ "types": "./types-cjs/index.d.cts",
34
+ "default": "./dist/html.cjs"
35
+ }
36
+ }
32
37
  },
33
38
  "peerDependencies": {
34
- "@solidjs/web": "^2.0.0-beta.6"
39
+ "@solidjs/web": "^2.0.0-beta.7"
35
40
  },
36
41
  "devDependencies": {
37
- "@solidjs/web": "2.0.0-beta.6"
42
+ "@solidjs/web": "2.0.0-beta.7"
38
43
  },
39
44
  "scripts": {
40
45
  "build": "npm-run-all -nl build:*",
41
46
  "build:clean": "rimraf dist/ coverage/",
42
47
  "build:js": "rollup -c",
43
- "types": "npm-run-all -nl types:*",
44
- "types:clean": "rimraf types/",
45
- "types:html": "tsc --project ./tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./types/lit.d.ts"
48
+ "types": "npm-run-all -nl types:clean types:html types:cjs",
49
+ "types:clean": "rimraf types/ types-cjs/",
50
+ "types:html": "tsc --project ./tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./types/lit.d.ts",
51
+ "types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs"
46
52
  }
47
53
  }
package/types/lit.d.ts CHANGED
@@ -1 +1,35 @@
1
- export * from "lit-dom-expressions";
1
+ type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
2
+ type ClassList = Record<string, boolean> | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
3
+ interface Runtime {
4
+ effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
5
+ untrack<T>(fn: () => T): T;
6
+ insert(parent: MountableElement, accessor: any, marker?: Node | null, init?: any): any;
7
+ spread<T>(node: Element, accessor: (() => T) | T, skipChildren?: Boolean): void;
8
+ createComponent(Comp: (props: any) => any, props: any): any;
9
+ addEventListener(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): void;
10
+ delegateEvents(eventNames: string[]): void;
11
+ className(node: Element, value: string | ClassList, prev?: string | ClassList): void;
12
+ style(node: Element, value: {
13
+ [k: string]: string;
14
+ }, prev?: {
15
+ [k: string]: string;
16
+ }): void;
17
+ mergeProps(...sources: unknown[]): unknown;
18
+ dynamicProperty(props: any, key: string): any;
19
+ setAttribute(node: Element, name: string, value: any): void;
20
+ setAttributeNS(node: Element, namespace: string, name: string, value: any): void;
21
+ DOMWithState: Record<string, Record<string, 1 | 2>>;
22
+ ChildProperties: Set<string>;
23
+ DelegatedEvents: Set<string>;
24
+ SVGElements: Set<string>;
25
+ MathMLElements: Set<string>;
26
+ Namespaces: Record<string, string>;
27
+ }
28
+ export type HTMLTag = {
29
+ (statics: TemplateStringsArray, ...args: unknown[]): Node | Node[];
30
+ };
31
+ export declare function createHTML(r: Runtime, { delegateEvents, functionBuilder }?: {
32
+ delegateEvents?: boolean;
33
+ functionBuilder?: (...args: string[]) => Function;
34
+ }): HTMLTag;
35
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { HTMLTag } from "./lit.cjs";
2
+ declare const html: HTMLTag;
3
+ export default html;
@@ -0,0 +1,35 @@
1
+ type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
2
+ type ClassList = Record<string, boolean> | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
3
+ interface Runtime {
4
+ effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
5
+ untrack<T>(fn: () => T): T;
6
+ insert(parent: MountableElement, accessor: any, marker?: Node | null, init?: any): any;
7
+ spread<T>(node: Element, accessor: (() => T) | T, skipChildren?: Boolean): void;
8
+ createComponent(Comp: (props: any) => any, props: any): any;
9
+ addEventListener(node: Element, name: string, handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions), delegate: boolean): void;
10
+ delegateEvents(eventNames: string[]): void;
11
+ className(node: Element, value: string | ClassList, prev?: string | ClassList): void;
12
+ style(node: Element, value: {
13
+ [k: string]: string;
14
+ }, prev?: {
15
+ [k: string]: string;
16
+ }): void;
17
+ mergeProps(...sources: unknown[]): unknown;
18
+ dynamicProperty(props: any, key: string): any;
19
+ setAttribute(node: Element, name: string, value: any): void;
20
+ setAttributeNS(node: Element, namespace: string, name: string, value: any): void;
21
+ DOMWithState: Record<string, Record<string, 1 | 2>>;
22
+ ChildProperties: Set<string>;
23
+ DelegatedEvents: Set<string>;
24
+ SVGElements: Set<string>;
25
+ MathMLElements: Set<string>;
26
+ Namespaces: Record<string, string>;
27
+ }
28
+ export type HTMLTag = {
29
+ (statics: TemplateStringsArray, ...args: unknown[]): Node | Node[];
30
+ };
31
+ export declare function createHTML(r: Runtime, { delegateEvents, functionBuilder }?: {
32
+ delegateEvents?: boolean;
33
+ functionBuilder?: (...args: string[]) => Function;
34
+ }): HTMLTag;
35
+ export {};
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }