@solidjs/web 2.0.0-beta.13 → 2.0.0-beta.15

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/types/jsx.d.ts CHANGED
@@ -224,9 +224,14 @@ export namespace JSX {
224
224
  >;
225
225
  // end event handlers
226
226
 
227
- type ClassList =
227
+ export type ClassValue =
228
+ | string
229
+ | number
230
+ | boolean
231
+ | null
232
+ | undefined
228
233
  | Record<string, boolean>
229
- | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
234
+ | ClassValue[];
230
235
 
231
236
  const SERIALIZABLE: unique symbol;
232
237
  interface SerializableAttributeValue {
@@ -269,11 +274,6 @@ export namespace JSX {
269
274
 
270
275
  // TODO: Should we allow this?
271
276
  // type ClassKeys = `class:${string}`;
272
- // type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
273
-
274
- // type CSSAttributes = {
275
- // [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
276
- // };
277
277
 
278
278
  // BOOLEAN
279
279
 
@@ -859,6 +859,20 @@ export namespace JSX {
859
859
  : never)
860
860
  | (string & {});
861
861
 
862
+ type ExtractEventType<T> = {
863
+ [K in keyof T as K extends `on${infer Name}` ? Name : never]: T[K] extends EventHandlerUnion<
864
+ Element,
865
+ infer E
866
+ >
867
+ ? E
868
+ : never;
869
+ };
870
+
871
+ // EventType["click"] = MouseEvent
872
+
873
+ type EventType = ExtractEventType<EventHandlersElement<Element>> &
874
+ ExtractEventType<EventHandlersWindow<Element>>;
875
+
862
876
  // GLOBAL ATTRIBUTES
863
877
 
864
878
  /**
@@ -890,7 +904,7 @@ export namespace JSX {
890
904
  * with reactive values directly; manually-built strings re-run the whole
891
905
  * concatenation on every change instead of toggling the affected classes.
892
906
  */
893
- class?: string | ClassList | RemoveAttribute;
907
+ class?: ClassValue | RemoveAttribute;
894
908
  elementtiming?: string | RemoveAttribute;
895
909
  id?: string | RemoveAttribute;
896
910
  nonce?: string | RemoveAttribute;
@@ -1532,6 +1546,10 @@ export namespace JSX {
1532
1546
  src?: string | RemoveAttribute;
1533
1547
 
1534
1548
  onEncrypted?: EventHandlerUnion<T, MediaEncryptedEvent> | undefined;
1549
+ onWaitingForKey?: EventHandlerUnion<T, Event> | undefined;
1550
+
1551
+ /** @deprecated */
1552
+ mediagroup?: string | RemoveAttribute;
1535
1553
 
1536
1554
  // special cases locked to properties
1537
1555
 
@@ -1866,6 +1884,11 @@ export namespace JSX {
1866
1884
  width?: number | string | RemoveAttribute;
1867
1885
 
1868
1886
  onEnterPictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1887
+ onLeavePictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1888
+ }
1889
+
1890
+ interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
1891
+ allowpopups?: BooleanAttribute | RemoveAttribute;
1869
1892
  disableblinkfeatures?: string | RemoveAttribute;
1870
1893
  disablewebsecurity?: BooleanAttribute | RemoveAttribute;
1871
1894
  enableblinkfeatures?: string | RemoveAttribute;
@@ -1968,7 +1991,7 @@ export namespace JSX {
1968
1991
  * with reactive values directly; manually-built strings re-run the whole
1969
1992
  * concatenation on every change instead of toggling the affected classes.
1970
1993
  */
1971
- class?: string | ClassList | RemoveAttribute;
1994
+ class?: ClassValue | RemoveAttribute;
1972
1995
  style?: CSSProperties | string | RemoveAttribute;
1973
1996
  }
1974
1997
  interface TransformableSVGAttributes {
@@ -2140,6 +2163,29 @@ export namespace JSX {
2140
2163
  interface AnimationElementSVGAttributes<T>
2141
2164
  extends SVGAttributes<T>, ExternalResourceSVGAttributes, ConditionalProcessingSVGAttributes {
2142
2165
  onBegin?: EventHandlerUnion<T, TimeEvent> | undefined;
2166
+ onEnd?: EventHandlerUnion<T, TimeEvent> | undefined;
2167
+ onRepeat?: EventHandlerUnion<T, TimeEvent> | undefined;
2168
+ }
2169
+
2170
+ interface ContainerElementSVGAttributes<T>
2171
+ extends
2172
+ SVGAttributes<T>,
2173
+ ShapeElementSVGAttributes<T>,
2174
+ Pick<
2175
+ PresentationSVGAttributes,
2176
+ | "clip-path"
2177
+ | "mask"
2178
+ | "cursor"
2179
+ | "opacity"
2180
+ | "filter"
2181
+ | "enable-background"
2182
+ | "color-interpolation"
2183
+ | "color-rendering"
2184
+ > {}
2185
+
2186
+ interface FilterPrimitiveElementSVGAttributes<T>
2187
+ extends SVGAttributes<T>, Pick<PresentationSVGAttributes, "color-interpolation-filters"> {
2188
+ height?: number | string | RemoveAttribute;
2143
2189
  result?: string | RemoveAttribute;
2144
2190
  width?: number | string | RemoveAttribute;
2145
2191
  x?: number | string | RemoveAttribute;
package/types/server.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { JSX } from "./jsx.js";
2
+ export const DOMWithState: Record<string, Record<string, 1 | 2>>;
2
3
  export const ChildProperties: Set<string>;
3
4
  export const DelegatedEvents: Set<string>;
4
5
  export const DOMElements: Set<string>;
@@ -124,7 +125,23 @@ export function insert<T>(
124
125
  export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
125
126
 
126
127
  /** @deprecated not supported on the server side */
127
- export function delegateEvents(eventNames: string[], d?: Document): void;
128
+ export function delegateEvents(eventNames: string[]): void;
129
+ /** @deprecated not supported on the server side */
130
+ export function registerDelegatedRoot(root: MountableElement): void;
131
+ /** @deprecated not supported on the server side */
132
+ export function unregisterDelegatedRoot(root: MountableElement): void;
133
+ /** @deprecated not supported on the server side */
134
+ export function registerDelegatedContainer(
135
+ container: MountableElement,
136
+ owner?: MountableElement
137
+ ): void;
138
+ /** @deprecated not supported on the server side */
139
+ export function unregisterDelegatedContainer(
140
+ container: MountableElement,
141
+ owner?: MountableElement
142
+ ): void;
143
+ /** @deprecated not supported on the server side */
144
+ export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
128
145
  /** @deprecated not supported on the server side */
129
146
  export function dynamicProperty(props: unknown, key: string): unknown;
130
147
  /** @deprecated not supported on the server side */
@@ -133,12 +150,7 @@ export function setAttribute(node: Element, name: string, value: string): void;
133
150
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
134
151
 
135
152
  /** @deprecated not supported on the server side */
136
- export function addEventListener(
137
- node: Element,
138
- name: string,
139
- handler: () => void,
140
- delegate: boolean
141
- ): void;
153
+ export function addEvent(node: Element, name: string, handler: () => void, delegate: boolean): void;
142
154
 
143
155
  /** @deprecated not supported on the server side */
144
156
  export function render(code: () => JSX.Element, element: MountableElement): () => void;
@@ -172,3 +184,10 @@ export function getNextMatch(start: Node, elementName: string): Element;
172
184
  export function getNextMarker(start: Node): [Node, Array<Node>];
173
185
  /** @deprecated not supported on the server side */
174
186
  export function runHydrationEvents(): void;
187
+ /** @deprecated not supported on the server side */
188
+ export function ref(
189
+ fn: () => ((element: Element) => void) | ((element: Element) => void)[],
190
+ element: Element
191
+ ): void;
192
+ /** @deprecated not supported on the server side */
193
+ export function setStyleProperty(node: Element, name: string, value: any): void;
@@ -30,11 +30,31 @@ export function insert<T>(
30
30
  parent: MountableElement,
31
31
  accessor: (() => T) | T,
32
32
  marker?: Node | null,
33
- init?: JSX.Element
33
+ init?: JSX.Element,
34
+ options?: {
35
+ /**
36
+ * Live accessor for the slot's logical host in the source tree (portals).
37
+ * Each top-level node the slot manages is tagged with a `_$host` getter
38
+ * backed by this accessor so delegated events retarget correctly.
39
+ */
40
+ host?: () => Node | null;
41
+ /** Defer the insert effect to the queue instead of running it inline. */
42
+ schedule?: boolean;
43
+ }
34
44
  ): JSX.Element;
35
45
  export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
36
- export function delegateEvents(eventNames: string[], d?: Document): void;
37
- export function clearDelegatedEvents(d?: Document): void;
46
+ export function delegateEvents(eventNames: string[]): void;
47
+ export function registerDelegatedRoot(root: MountableElement): void;
48
+ export function unregisterDelegatedRoot(root: MountableElement): void;
49
+ export function registerDelegatedContainer(
50
+ container: MountableElement,
51
+ owner?: MountableElement
52
+ ): void;
53
+ export function unregisterDelegatedContainer(
54
+ container: MountableElement,
55
+ owner?: MountableElement
56
+ ): void;
57
+ export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
38
58
  export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
39
59
  export function assign(
40
60
  node: Element,
@@ -45,17 +65,10 @@ export function assign(
45
65
  ): void;
46
66
  export function setAttribute(node: Element, name: string, value: string): void;
47
67
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
48
- type ClassList =
49
- | Record<string, boolean>
50
- | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
51
- export function className(
52
- node: Element,
53
- value: string | ClassList,
54
- prev?: string | ClassList
55
- ): void;
68
+ export function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
56
69
  export function setProperty(node: Element, name: string, value: any): void;
57
70
  export function setStyleProperty(node: Element, name: string, value: any): void;
58
- export function addEventListener(
71
+ export function addEvent(
59
72
  node: Element,
60
73
  name: string,
61
74
  handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
@@ -31,6 +31,7 @@ export type PropValue =
31
31
  | MediaSource
32
32
  | Blob
33
33
  | File
34
+ | Date
34
35
  | Element;
35
36
 
36
37
  /**
@@ -224,9 +224,14 @@ export namespace JSX {
224
224
  >;
225
225
  // end event handlers
226
226
 
227
- type ClassList =
227
+ export type ClassValue =
228
+ | string
229
+ | number
230
+ | boolean
231
+ | null
232
+ | undefined
228
233
  | Record<string, boolean>
229
- | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
234
+ | ClassValue[];
230
235
 
231
236
  const SERIALIZABLE: unique symbol;
232
237
  interface SerializableAttributeValue {
@@ -269,11 +274,6 @@ export namespace JSX {
269
274
 
270
275
  // TODO: Should we allow this?
271
276
  // type ClassKeys = `class:${string}`;
272
- // type CSSKeys = Exclude<keyof csstype.PropertiesHyphen, `-${string}`>;
273
-
274
- // type CSSAttributes = {
275
- // [key in CSSKeys as `style:${key}`]: csstype.PropertiesHyphen[key];
276
- // };
277
277
 
278
278
  // BOOLEAN
279
279
 
@@ -859,6 +859,20 @@ export namespace JSX {
859
859
  : never)
860
860
  | (string & {});
861
861
 
862
+ type ExtractEventType<T> = {
863
+ [K in keyof T as K extends `on${infer Name}` ? Name : never]: T[K] extends EventHandlerUnion<
864
+ Element,
865
+ infer E
866
+ >
867
+ ? E
868
+ : never;
869
+ };
870
+
871
+ // EventType["click"] = MouseEvent
872
+
873
+ type EventType = ExtractEventType<EventHandlersElement<Element>> &
874
+ ExtractEventType<EventHandlersWindow<Element>>;
875
+
862
876
  // GLOBAL ATTRIBUTES
863
877
 
864
878
  /**
@@ -890,7 +904,7 @@ export namespace JSX {
890
904
  * with reactive values directly; manually-built strings re-run the whole
891
905
  * concatenation on every change instead of toggling the affected classes.
892
906
  */
893
- class?: string | ClassList | RemoveAttribute;
907
+ class?: ClassValue | RemoveAttribute;
894
908
  elementtiming?: string | RemoveAttribute;
895
909
  id?: string | RemoveAttribute;
896
910
  nonce?: string | RemoveAttribute;
@@ -1532,6 +1546,10 @@ export namespace JSX {
1532
1546
  src?: string | RemoveAttribute;
1533
1547
 
1534
1548
  onEncrypted?: EventHandlerUnion<T, MediaEncryptedEvent> | undefined;
1549
+ onWaitingForKey?: EventHandlerUnion<T, Event> | undefined;
1550
+
1551
+ /** @deprecated */
1552
+ mediagroup?: string | RemoveAttribute;
1535
1553
 
1536
1554
  // special cases locked to properties
1537
1555
 
@@ -1866,6 +1884,11 @@ export namespace JSX {
1866
1884
  width?: number | string | RemoveAttribute;
1867
1885
 
1868
1886
  onEnterPictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1887
+ onLeavePictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1888
+ }
1889
+
1890
+ interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
1891
+ allowpopups?: BooleanAttribute | RemoveAttribute;
1869
1892
  disableblinkfeatures?: string | RemoveAttribute;
1870
1893
  disablewebsecurity?: BooleanAttribute | RemoveAttribute;
1871
1894
  enableblinkfeatures?: string | RemoveAttribute;
@@ -1968,7 +1991,7 @@ export namespace JSX {
1968
1991
  * with reactive values directly; manually-built strings re-run the whole
1969
1992
  * concatenation on every change instead of toggling the affected classes.
1970
1993
  */
1971
- class?: string | ClassList | RemoveAttribute;
1994
+ class?: ClassValue | RemoveAttribute;
1972
1995
  style?: CSSProperties | string | RemoveAttribute;
1973
1996
  }
1974
1997
  interface TransformableSVGAttributes {
@@ -2140,6 +2163,29 @@ export namespace JSX {
2140
2163
  interface AnimationElementSVGAttributes<T>
2141
2164
  extends SVGAttributes<T>, ExternalResourceSVGAttributes, ConditionalProcessingSVGAttributes {
2142
2165
  onBegin?: EventHandlerUnion<T, TimeEvent> | undefined;
2166
+ onEnd?: EventHandlerUnion<T, TimeEvent> | undefined;
2167
+ onRepeat?: EventHandlerUnion<T, TimeEvent> | undefined;
2168
+ }
2169
+
2170
+ interface ContainerElementSVGAttributes<T>
2171
+ extends
2172
+ SVGAttributes<T>,
2173
+ ShapeElementSVGAttributes<T>,
2174
+ Pick<
2175
+ PresentationSVGAttributes,
2176
+ | "clip-path"
2177
+ | "mask"
2178
+ | "cursor"
2179
+ | "opacity"
2180
+ | "filter"
2181
+ | "enable-background"
2182
+ | "color-interpolation"
2183
+ | "color-rendering"
2184
+ > {}
2185
+
2186
+ interface FilterPrimitiveElementSVGAttributes<T>
2187
+ extends SVGAttributes<T>, Pick<PresentationSVGAttributes, "color-interpolation-filters"> {
2188
+ height?: number | string | RemoveAttribute;
2143
2189
  result?: string | RemoveAttribute;
2144
2190
  width?: number | string | RemoveAttribute;
2145
2191
  x?: number | string | RemoveAttribute;
@@ -1,4 +1,5 @@
1
1
  import { JSX } from "./jsx.cjs";
2
+ export const DOMWithState: Record<string, Record<string, 1 | 2>>;
2
3
  export const ChildProperties: Set<string>;
3
4
  export const DelegatedEvents: Set<string>;
4
5
  export const DOMElements: Set<string>;
@@ -124,7 +125,23 @@ export function insert<T>(
124
125
  export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
125
126
 
126
127
  /** @deprecated not supported on the server side */
127
- export function delegateEvents(eventNames: string[], d?: Document): void;
128
+ export function delegateEvents(eventNames: string[]): void;
129
+ /** @deprecated not supported on the server side */
130
+ export function registerDelegatedRoot(root: MountableElement): void;
131
+ /** @deprecated not supported on the server side */
132
+ export function unregisterDelegatedRoot(root: MountableElement): void;
133
+ /** @deprecated not supported on the server side */
134
+ export function registerDelegatedContainer(
135
+ container: MountableElement,
136
+ owner?: MountableElement
137
+ ): void;
138
+ /** @deprecated not supported on the server side */
139
+ export function unregisterDelegatedContainer(
140
+ container: MountableElement,
141
+ owner?: MountableElement
142
+ ): void;
143
+ /** @deprecated not supported on the server side */
144
+ export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
128
145
  /** @deprecated not supported on the server side */
129
146
  export function dynamicProperty(props: unknown, key: string): unknown;
130
147
  /** @deprecated not supported on the server side */
@@ -133,12 +150,7 @@ export function setAttribute(node: Element, name: string, value: string): void;
133
150
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
134
151
 
135
152
  /** @deprecated not supported on the server side */
136
- export function addEventListener(
137
- node: Element,
138
- name: string,
139
- handler: () => void,
140
- delegate: boolean
141
- ): void;
153
+ export function addEvent(node: Element, name: string, handler: () => void, delegate: boolean): void;
142
154
 
143
155
  /** @deprecated not supported on the server side */
144
156
  export function render(code: () => JSX.Element, element: MountableElement): () => void;
@@ -172,3 +184,10 @@ export function getNextMatch(start: Node, elementName: string): Element;
172
184
  export function getNextMarker(start: Node): [Node, Array<Node>];
173
185
  /** @deprecated not supported on the server side */
174
186
  export function runHydrationEvents(): void;
187
+ /** @deprecated not supported on the server side */
188
+ export function ref(
189
+ fn: () => ((element: Element) => void) | ((element: Element) => void)[],
190
+ element: Element
191
+ ): void;
192
+ /** @deprecated not supported on the server side */
193
+ export function setStyleProperty(node: Element, name: string, value: any): void;