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

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/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;
@@ -33,8 +33,18 @@ export function insert<T>(
33
33
  init?: JSX.Element
34
34
  ): JSX.Element;
35
35
  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;
36
+ export function delegateEvents(eventNames: string[]): void;
37
+ export function registerDelegatedRoot(root: MountableElement): void;
38
+ export function unregisterDelegatedRoot(root: MountableElement): void;
39
+ export function registerDelegatedContainer(
40
+ container: MountableElement,
41
+ owner?: MountableElement
42
+ ): void;
43
+ export function unregisterDelegatedContainer(
44
+ container: MountableElement,
45
+ owner?: MountableElement
46
+ ): void;
47
+ export function getDelegatedRoot(node: MountableElement): MountableElement | undefined;
38
48
  export function spread<T>(node: Element, accessor: T, skipChildren?: Boolean): void;
39
49
  export function assign(
40
50
  node: Element,
@@ -45,17 +55,10 @@ export function assign(
45
55
  ): void;
46
56
  export function setAttribute(node: Element, name: string, value: string): void;
47
57
  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;
58
+ export function className(node: Element, value: JSX.ClassValue, prev?: JSX.ClassValue): void;
56
59
  export function setProperty(node: Element, name: string, value: any): void;
57
60
  export function setStyleProperty(node: Element, name: string, value: any): void;
58
- export function addEventListener(
61
+ export function addEvent(
59
62
  node: Element,
60
63
  name: string,
61
64
  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,7 +224,8 @@ export namespace JSX {
224
224
  >;
225
225
  // end event handlers
226
226
 
227
- type ClassList =
227
+ export type ClassValue =
228
+ | string
228
229
  | Record<string, boolean>
229
230
  | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
230
231
 
@@ -269,11 +270,6 @@ export namespace JSX {
269
270
 
270
271
  // TODO: Should we allow this?
271
272
  // 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
273
 
278
274
  // BOOLEAN
279
275
 
@@ -859,6 +855,20 @@ export namespace JSX {
859
855
  : never)
860
856
  | (string & {});
861
857
 
858
+ type ExtractEventType<T> = {
859
+ [K in keyof T as K extends `on${infer Name}` ? Name : never]: T[K] extends EventHandlerUnion<
860
+ Element,
861
+ infer E
862
+ >
863
+ ? E
864
+ : never;
865
+ };
866
+
867
+ // EventType["click"] = MouseEvent
868
+
869
+ type EventType = ExtractEventType<EventHandlersElement<Element>> &
870
+ ExtractEventType<EventHandlersWindow<Element>>;
871
+
862
872
  // GLOBAL ATTRIBUTES
863
873
 
864
874
  /**
@@ -890,7 +900,7 @@ export namespace JSX {
890
900
  * with reactive values directly; manually-built strings re-run the whole
891
901
  * concatenation on every change instead of toggling the affected classes.
892
902
  */
893
- class?: string | ClassList | RemoveAttribute;
903
+ class?: ClassValue | RemoveAttribute;
894
904
  elementtiming?: string | RemoveAttribute;
895
905
  id?: string | RemoveAttribute;
896
906
  nonce?: string | RemoveAttribute;
@@ -1532,6 +1542,10 @@ export namespace JSX {
1532
1542
  src?: string | RemoveAttribute;
1533
1543
 
1534
1544
  onEncrypted?: EventHandlerUnion<T, MediaEncryptedEvent> | undefined;
1545
+ onWaitingForKey?: EventHandlerUnion<T, Event> | undefined;
1546
+
1547
+ /** @deprecated */
1548
+ mediagroup?: string | RemoveAttribute;
1535
1549
 
1536
1550
  // special cases locked to properties
1537
1551
 
@@ -1866,6 +1880,11 @@ export namespace JSX {
1866
1880
  width?: number | string | RemoveAttribute;
1867
1881
 
1868
1882
  onEnterPictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1883
+ onLeavePictureInPicture?: EventHandlerUnion<T, PictureInPictureEvent> | undefined;
1884
+ }
1885
+
1886
+ interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> {
1887
+ allowpopups?: BooleanAttribute | RemoveAttribute;
1869
1888
  disableblinkfeatures?: string | RemoveAttribute;
1870
1889
  disablewebsecurity?: BooleanAttribute | RemoveAttribute;
1871
1890
  enableblinkfeatures?: string | RemoveAttribute;
@@ -1968,7 +1987,7 @@ export namespace JSX {
1968
1987
  * with reactive values directly; manually-built strings re-run the whole
1969
1988
  * concatenation on every change instead of toggling the affected classes.
1970
1989
  */
1971
- class?: string | ClassList | RemoveAttribute;
1990
+ class?: ClassValue | RemoveAttribute;
1972
1991
  style?: CSSProperties | string | RemoveAttribute;
1973
1992
  }
1974
1993
  interface TransformableSVGAttributes {
@@ -2140,6 +2159,29 @@ export namespace JSX {
2140
2159
  interface AnimationElementSVGAttributes<T>
2141
2160
  extends SVGAttributes<T>, ExternalResourceSVGAttributes, ConditionalProcessingSVGAttributes {
2142
2161
  onBegin?: EventHandlerUnion<T, TimeEvent> | undefined;
2162
+ onEnd?: EventHandlerUnion<T, TimeEvent> | undefined;
2163
+ onRepeat?: EventHandlerUnion<T, TimeEvent> | undefined;
2164
+ }
2165
+
2166
+ interface ContainerElementSVGAttributes<T>
2167
+ extends
2168
+ SVGAttributes<T>,
2169
+ ShapeElementSVGAttributes<T>,
2170
+ Pick<
2171
+ PresentationSVGAttributes,
2172
+ | "clip-path"
2173
+ | "mask"
2174
+ | "cursor"
2175
+ | "opacity"
2176
+ | "filter"
2177
+ | "enable-background"
2178
+ | "color-interpolation"
2179
+ | "color-rendering"
2180
+ > {}
2181
+
2182
+ interface FilterPrimitiveElementSVGAttributes<T>
2183
+ extends SVGAttributes<T>, Pick<PresentationSVGAttributes, "color-interpolation-filters"> {
2184
+ height?: number | string | RemoveAttribute;
2143
2185
  result?: string | RemoveAttribute;
2144
2186
  width?: number | string | RemoveAttribute;
2145
2187
  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;