@vertz/ui 0.2.23 → 0.2.25

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.
Files changed (36) hide show
  1. package/dist/shared/chunk-09ntccdx.js +39 -0
  2. package/dist/shared/{chunk-g6fb5yc2.js → chunk-1jgws7rs.js} +210 -258
  3. package/dist/shared/{chunk-016m1fq0.js → chunk-2krx4aqe.js} +119 -15
  4. package/dist/shared/{chunk-f4d5nphq.js → chunk-7nr2ebrf.js} +1 -1
  5. package/dist/shared/{chunk-4gmtsf6v.js → chunk-bk7mmn92.js} +1 -1
  6. package/dist/shared/chunk-djvarb8r.js +333 -0
  7. package/dist/shared/{chunk-jtma4sh4.js → chunk-e09mdqcx.js} +2 -2
  8. package/dist/shared/{chunk-4xkw6h1s.js → chunk-h1fsr8kv.js} +67 -1
  9. package/dist/shared/{chunk-xhc7arn9.js → chunk-j1a7t906.js} +14 -12
  10. package/dist/shared/{chunk-656n0x6y.js → chunk-ppr06jgn.js} +8 -2
  11. package/dist/shared/{chunk-2kyhn86t.js → chunk-svvqjmyy.js} +5 -63
  12. package/dist/shared/{chunk-da2w7j7w.js → chunk-xs5s8gqe.js} +1 -1
  13. package/dist/shared/{chunk-p3fz6qqp.js → chunk-ymc3wwam.js} +8 -2
  14. package/dist/src/auth/public.d.ts +35 -1
  15. package/dist/src/auth/public.js +72 -3
  16. package/dist/src/components/index.d.ts +3 -2
  17. package/dist/src/components/index.js +56 -46
  18. package/dist/src/css/public.d.ts +5 -1
  19. package/dist/src/css/public.js +4 -5
  20. package/dist/src/form/public.js +2 -2
  21. package/dist/src/index.d.ts +162 -53
  22. package/dist/src/index.js +341 -320
  23. package/dist/src/internals.d.ts +85 -10
  24. package/dist/src/internals.js +380 -90
  25. package/dist/src/jsx-runtime/index.js +3 -5
  26. package/dist/src/query/public.d.ts +6 -33
  27. package/dist/src/query/public.js +5 -7
  28. package/dist/src/router/public.d.ts +27 -4
  29. package/dist/src/router/public.js +8 -10
  30. package/dist/src/test/index.d.ts +12 -3
  31. package/dist/src/test/index.js +3 -3
  32. package/package.json +4 -3
  33. package/reactivity.json +1 -1
  34. package/dist/shared/chunk-13tvh4wq.js +0 -229
  35. package/dist/shared/chunk-2y9f9j62.js +0 -40
  36. package/dist/shared/chunk-prj7nm08.js +0 -67
@@ -29,16 +29,12 @@ interface ReadonlySignal<T> {
29
29
  * type UnwrappedData = Unwrapped<ReadonlySignal<Task | undefined>>; // → Task | undefined
30
30
  */
31
31
  type Unwrapped<T> = T extends ReadonlySignal<infer U> ? U : T;
32
- /** Dispose function returned by effect(). */
33
- type DisposeFn = () => void;
34
32
  /** Options for query(). */
35
33
  interface QueryOptions<T> {
36
34
  /** Pre-populated data — skips the initial fetch when provided. */
37
35
  initialData?: T;
38
36
  /** Debounce re-fetches triggered by reactive dependency changes (ms). */
39
37
  debounce?: number;
40
- /** When false, the query will not fetch. Defaults to true. */
41
- enabled?: boolean;
42
38
  /** Explicit cache key. When omitted, derived from the thunk. */
43
39
  key?: string;
44
40
  /** Custom cache store. Defaults to a shared in-memory Map. */
@@ -72,6 +68,8 @@ interface QueryResult<
72
68
  readonly revalidating: Unwrapped<ReadonlySignal<boolean>>;
73
69
  /** The error from the latest failed fetch, or undefined. */
74
70
  readonly error: Unwrapped<ReadonlySignal<E | undefined>>;
71
+ /** True when the query has never fetched (thunk returned null or not yet run). */
72
+ readonly idle: Unwrapped<ReadonlySignal<boolean>>;
75
73
  /** Manually trigger a refetch (clears cache for this key). */
76
74
  refetch: () => void;
77
75
  /** Alias for refetch — revalidate the cached data. */
@@ -93,34 +91,9 @@ declare function query<
93
91
  T,
94
92
  E
95
93
  >(descriptor: QueryDescriptor<T, E>, options?: Omit<QueryOptions<T>, "key">): QueryResult<T, E>;
96
- declare function query<T>(thunk: () => Promise<T>, options?: QueryOptions<T>): QueryResult<T>;
97
- interface QueryMatchHandlers<
98
- T,
99
- E
100
- > {
101
- loading: () => Node | null;
102
- error: (error: E) => Node | null;
103
- data: (data: T) => Node | null;
104
- }
105
- /**
106
- * Pattern-match on a QueryResult's exclusive state.
107
- *
108
- * Returns a stable `<span style="display:contents">` wrapper that internally
109
- * manages branch switching (loading/error/data) via a reactive effect.
110
- * The same wrapper is returned for repeated calls with the same queryResult
111
- * (cached via WeakMap), enabling __child's stable-node optimization.
112
- *
113
- * Priority: loading → error → data.
114
- *
115
- * `loading` only fires on the initial load (no data yet).
116
- * When revalidating with existing data, the `data` handler receives the
117
- * current data. Access `query.revalidating` from the component scope for
118
- * revalidation state.
119
- */
120
- declare function queryMatch<
94
+ declare function query<
121
95
  T,
122
96
  E
123
- >(queryResult: QueryResult<T, E>, handlers: QueryMatchHandlers<T, E>): HTMLElement & {
124
- dispose: DisposeFn;
125
- };
126
- export { queryMatch, query, isQueryDescriptor, QueryResult, QueryOptions, QueryMatchHandlers, QueryDescriptor2 as QueryDescriptor, CacheStore };
97
+ >(thunk: () => QueryDescriptor<T, E> | null, options?: Omit<QueryOptions<T>, "key">): QueryResult<T, E>;
98
+ declare function query<T>(thunk: () => Promise<T> | null, options?: QueryOptions<T>): QueryResult<T>;
99
+ export { query, isQueryDescriptor, QueryResult, QueryOptions, QueryDescriptor2 as QueryDescriptor, CacheStore };
@@ -1,16 +1,14 @@
1
1
  import {
2
- query,
3
- queryMatch
4
- } from "../../shared/chunk-g6fb5yc2.js";
2
+ query
3
+ } from "../../shared/chunk-1jgws7rs.js";
5
4
  import"../../shared/chunk-jrtrk5z4.js";
6
- import"../../shared/chunk-2y9f9j62.js";
7
- import"../../shared/chunk-da2w7j7w.js";
8
- import"../../shared/chunk-656n0x6y.js";
5
+ import"../../shared/chunk-09ntccdx.js";
6
+ import"../../shared/chunk-xs5s8gqe.js";
7
+ import"../../shared/chunk-ppr06jgn.js";
9
8
 
10
9
  // src/query/public.ts
11
10
  import { isQueryDescriptor } from "@vertz/fetch";
12
11
  export {
13
- queryMatch,
14
12
  query,
15
13
  isQueryDescriptor
16
14
  };
@@ -93,7 +93,10 @@ interface RouteConfig<
93
93
  signal: AbortSignal;
94
94
  }) => Promise<TLoaderData> | TLoaderData;
95
95
  /** Optional error component rendered when loader throws. */
96
- errorComponent?: (error: Error) => Node;
96
+ errorComponent?: (props: {
97
+ error: Error;
98
+ retry: () => void;
99
+ }) => Node;
97
100
  /** Optional path params schema for validation/parsing. */
98
101
  params?: ParamSchema<TParams>;
99
102
  /** Optional search params schema for validation/coercion. */
@@ -131,7 +134,10 @@ interface RouteConfigLike {
131
134
  params: Record<string, string>;
132
135
  signal: AbortSignal;
133
136
  }): unknown;
134
- errorComponent?: (error: Error) => Node;
137
+ errorComponent?: (props: {
138
+ error: Error;
139
+ retry: () => void;
140
+ }) => Node;
135
141
  params?: ParamSchema<unknown>;
136
142
  searchParams?: SearchParamSchema<unknown>;
137
143
  children?: Record<string, RouteConfigLike>;
@@ -165,7 +171,10 @@ interface CompiledRoute {
165
171
  params: Record<string, string>;
166
172
  signal: AbortSignal;
167
173
  }) => Promise<unknown> | unknown;
168
- errorComponent?: RouteConfig["errorComponent"];
174
+ errorComponent?: (props: {
175
+ error: Error;
176
+ retry: () => void;
177
+ }) => Node;
169
178
  /** Optional path params schema for validation/parsing. */
170
179
  params?: ParamSchema<unknown>;
171
180
  searchParams?: RouteConfig["searchParams"];
@@ -449,9 +458,23 @@ declare function useRouter<T extends Record<string, RouteConfigLike> = RouteDefi
449
458
  */
450
459
  declare function useParams<TPath extends string = string>(): ExtractParams<TPath>;
451
460
  declare function useParams<T extends Record<string, unknown>>(): T;
461
+ /** Props for error fallback components (shared by DefaultErrorFallback and route errorComponent). */
462
+ interface ErrorFallbackProps {
463
+ error: Error;
464
+ retry: () => void;
465
+ }
466
+ /** Error fallback component signature, reuses ErrorFallbackProps from DefaultErrorFallback. */
467
+ type ErrorFallbackFn = (props: ErrorFallbackProps) => Node;
452
468
  interface RouterViewProps {
453
469
  router: Router;
470
+ /** Rendered when no route matches (404). */
454
471
  fallback?: () => Node;
472
+ /**
473
+ * Global error fallback for all routes. When set, every route component is
474
+ * automatically wrapped in an ErrorBoundary using this fallback.
475
+ * Per-route `errorComponent` takes precedence over this.
476
+ */
477
+ errorFallback?: ErrorFallbackFn;
455
478
  }
456
479
  /**
457
480
  * Renders the matched route's component inside a container div.
@@ -464,7 +487,7 @@ interface RouterViewProps {
464
487
  * domEffect runs the component factory (to attach reactivity/event handlers)
465
488
  * but skips clearing the container.
466
489
  */
467
- declare function RouterView({ router, fallback }: RouterViewProps): HTMLElement;
490
+ declare function RouterView({ router, fallback, errorFallback }: RouterViewProps): HTMLElement;
468
491
  /**
469
492
  * Parse URLSearchParams into a typed object, optionally through a schema.
470
493
  *
@@ -6,26 +6,24 @@ import {
6
6
  createLink,
7
7
  parseSearchParams,
8
8
  useSearchParams
9
- } from "../../shared/chunk-016m1fq0.js";
10
- import"../../shared/chunk-2kyhn86t.js";
11
- import"../../shared/chunk-4xkw6h1s.js";
9
+ } from "../../shared/chunk-2krx4aqe.js";
10
+ import"../../shared/chunk-svvqjmyy.js";
12
11
  import {
13
12
  createRouter
14
- } from "../../shared/chunk-jtma4sh4.js";
13
+ } from "../../shared/chunk-e09mdqcx.js";
15
14
  import {
16
15
  defineRoutes
17
16
  } from "../../shared/chunk-am9zaw4h.js";
18
17
  import"../../shared/chunk-jrtrk5z4.js";
19
- import"../../shared/chunk-13tvh4wq.js";
20
- import"../../shared/chunk-prj7nm08.js";
21
- import"../../shared/chunk-2y9f9j62.js";
18
+ import"../../shared/chunk-djvarb8r.js";
19
+ import"../../shared/chunk-h1fsr8kv.js";
22
20
  import {
23
21
  RouterContext,
24
22
  useParams,
25
23
  useRouter
26
- } from "../../shared/chunk-f4d5nphq.js";
27
- import"../../shared/chunk-da2w7j7w.js";
28
- import"../../shared/chunk-656n0x6y.js";
24
+ } from "../../shared/chunk-7nr2ebrf.js";
25
+ import"../../shared/chunk-xs5s8gqe.js";
26
+ import"../../shared/chunk-ppr06jgn.js";
29
27
  export {
30
28
  useSearchParams,
31
29
  useRouter,
@@ -187,7 +187,10 @@ interface RouteConfig<
187
187
  signal: AbortSignal;
188
188
  }) => Promise<TLoaderData> | TLoaderData;
189
189
  /** Optional error component rendered when loader throws. */
190
- errorComponent?: (error: Error) => Node;
190
+ errorComponent?: (props: {
191
+ error: Error;
192
+ retry: () => void;
193
+ }) => Node;
191
194
  /** Optional path params schema for validation/parsing. */
192
195
  params?: ParamSchema<TParams>;
193
196
  /** Optional search params schema for validation/coercion. */
@@ -225,7 +228,10 @@ interface RouteConfigLike {
225
228
  params: Record<string, string>;
226
229
  signal: AbortSignal;
227
230
  }): unknown;
228
- errorComponent?: (error: Error) => Node;
231
+ errorComponent?: (props: {
232
+ error: Error;
233
+ retry: () => void;
234
+ }) => Node;
229
235
  params?: ParamSchema<unknown>;
230
236
  searchParams?: SearchParamSchema<unknown>;
231
237
  children?: Record<string, RouteConfigLike>;
@@ -243,7 +249,10 @@ interface CompiledRoute {
243
249
  params: Record<string, string>;
244
250
  signal: AbortSignal;
245
251
  }) => Promise<unknown> | unknown;
246
- errorComponent?: RouteConfig["errorComponent"];
252
+ errorComponent?: (props: {
253
+ error: Error;
254
+ retry: () => void;
255
+ }) => Node;
247
256
  /** Optional path params schema for validation/parsing. */
248
257
  params?: ParamSchema<unknown>;
249
258
  searchParams?: RouteConfig["searchParams"];
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRouter
3
- } from "../../shared/chunk-jtma4sh4.js";
3
+ } from "../../shared/chunk-e09mdqcx.js";
4
4
  import {
5
5
  defineRoutes
6
6
  } from "../../shared/chunk-am9zaw4h.js";
7
7
  import"../../shared/chunk-jrtrk5z4.js";
8
- import"../../shared/chunk-da2w7j7w.js";
9
- import"../../shared/chunk-656n0x6y.js";
8
+ import"../../shared/chunk-xs5s8gqe.js";
9
+ import"../../shared/chunk-ppr06jgn.js";
10
10
 
11
11
  // src/test/interactions.ts
12
12
  async function click(el) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI framework — signals, components, JSX runtime",
@@ -69,15 +69,16 @@
69
69
  "scripts": {
70
70
  "build": "bunup",
71
71
  "test": "bun test",
72
+ "test:benchmark": "bun test src/dom/__tests__/hydration-deferred-effects-bench.local.ts",
72
73
  "test:watch": "bun test --watch",
73
74
  "typecheck": "tsc --noEmit"
74
75
  },
75
76
  "dependencies": {
76
- "@vertz/fetch": "^0.2.22"
77
+ "@vertz/fetch": "^0.2.24"
77
78
  },
78
79
  "devDependencies": {
79
80
  "@happy-dom/global-registrator": "^20.7.0",
80
- "@vertz/schema": "^0.2.22",
81
+ "@vertz/schema": "^0.2.24",
81
82
  "bunup": "^0.16.31",
82
83
  "happy-dom": "^20.7.0",
83
84
  "typescript": "^5.7.0"
package/reactivity.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "kind": "function",
30
30
  "reactivity": {
31
31
  "plainProperties": ["refetch", "revalidate", "dispose"],
32
- "signalProperties": ["data", "loading", "error", "revalidating"],
32
+ "signalProperties": ["data", "loading", "error", "revalidating", "idle"],
33
33
  "type": "signal-api"
34
34
  }
35
35
  },
@@ -1,229 +0,0 @@
1
- import {
2
- SVG_NS,
3
- isSVGTag,
4
- normalizeSVGAttr
5
- } from "./chunk-prj7nm08.js";
6
- import {
7
- getAdapter,
8
- isRenderNode
9
- } from "./chunk-2y9f9j62.js";
10
- import {
11
- claimElement,
12
- claimText,
13
- deferredDomEffect,
14
- domEffect,
15
- enterChildren,
16
- exitChildren,
17
- getIsHydrating,
18
- pauseHydration,
19
- popScope,
20
- pushScope,
21
- resumeHydration,
22
- runCleanups
23
- } from "./chunk-656n0x6y.js";
24
-
25
- // src/dom/element.ts
26
- var MAX_THUNK_DEPTH = 100;
27
- function resolveAndAppend(parent, value, depth = 0) {
28
- if (depth >= MAX_THUNK_DEPTH) {
29
- throw new Error("resolveAndAppend: max recursion depth exceeded — possible circular thunk");
30
- }
31
- if (value == null || typeof value === "boolean") {
32
- return;
33
- }
34
- if (typeof value === "function") {
35
- resolveAndAppend(parent, value(), depth + 1);
36
- return;
37
- }
38
- if (Array.isArray(value)) {
39
- for (const item of value) {
40
- resolveAndAppend(parent, item, depth);
41
- }
42
- return;
43
- }
44
- if (isRenderNode(value)) {
45
- parent.appendChild(value);
46
- return;
47
- }
48
- const text = typeof value === "string" ? value : String(value);
49
- parent.appendChild(getAdapter().createTextNode(text));
50
- }
51
- function __text(fn) {
52
- if (getIsHydrating()) {
53
- const claimed = claimText();
54
- if (claimed) {
55
- const node2 = claimed;
56
- node2.dispose = deferredDomEffect(() => {
57
- node2.data = fn();
58
- });
59
- return node2;
60
- }
61
- }
62
- const node = getAdapter().createTextNode("");
63
- node.dispose = domEffect(() => {
64
- node.data = fn();
65
- });
66
- return node;
67
- }
68
- function __child(fn) {
69
- let wrapper;
70
- if (getIsHydrating()) {
71
- const claimed = claimElement("span");
72
- if (claimed) {
73
- wrapper = claimed;
74
- while (wrapper.firstChild) {
75
- wrapper.removeChild(wrapper.firstChild);
76
- }
77
- pauseHydration();
78
- try {
79
- let childCleanups2 = [];
80
- wrapper.dispose = domEffect(() => {
81
- runCleanups(childCleanups2);
82
- const needsPause = getIsHydrating();
83
- if (needsPause)
84
- pauseHydration();
85
- try {
86
- const scope = pushScope();
87
- const value = fn();
88
- popScope();
89
- childCleanups2 = scope;
90
- if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
91
- return;
92
- }
93
- if (!isRenderNode(value) && value != null && typeof value !== "boolean" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
94
- const text = typeof value === "string" ? value : String(value);
95
- wrapper.firstChild.data = text;
96
- return;
97
- }
98
- while (wrapper.firstChild) {
99
- wrapper.removeChild(wrapper.firstChild);
100
- }
101
- resolveAndAppend(wrapper, value);
102
- } finally {
103
- if (needsPause)
104
- resumeHydration();
105
- }
106
- });
107
- } finally {
108
- resumeHydration();
109
- }
110
- return wrapper;
111
- }
112
- }
113
- wrapper = getAdapter().createElement("span");
114
- wrapper.style.display = "contents";
115
- let childCleanups = [];
116
- wrapper.dispose = domEffect(() => {
117
- runCleanups(childCleanups);
118
- const scope = pushScope();
119
- const value = fn();
120
- popScope();
121
- childCleanups = scope;
122
- if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
123
- return;
124
- }
125
- if (!isRenderNode(value) && value != null && typeof value !== "boolean" && typeof value !== "function" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
126
- const text = typeof value === "string" ? value : String(value);
127
- wrapper.firstChild.data = text;
128
- return;
129
- }
130
- while (wrapper.firstChild) {
131
- wrapper.removeChild(wrapper.firstChild);
132
- }
133
- resolveAndAppend(wrapper, value);
134
- });
135
- return wrapper;
136
- }
137
- function resolveAndInsert(parent, value, depth = 0) {
138
- if (depth >= MAX_THUNK_DEPTH) {
139
- throw new Error("__insert: max recursion depth exceeded — possible circular thunk");
140
- }
141
- if (value == null || typeof value === "boolean") {
142
- return;
143
- }
144
- if (typeof value === "function") {
145
- resolveAndInsert(parent, value(), depth + 1);
146
- return;
147
- }
148
- if (Array.isArray(value)) {
149
- for (const item of value) {
150
- resolveAndInsert(parent, item, depth);
151
- }
152
- return;
153
- }
154
- insertLeaf(parent, value);
155
- }
156
- function insertLeaf(parent, value) {
157
- if (getIsHydrating()) {
158
- if (isRenderNode(value)) {
159
- return;
160
- }
161
- claimText();
162
- return;
163
- }
164
- if (isRenderNode(value)) {
165
- parent.appendChild(value);
166
- return;
167
- }
168
- const text = typeof value === "string" ? value : String(value);
169
- parent.appendChild(getAdapter().createTextNode(text));
170
- }
171
- function __insert(parent, value) {
172
- if (value == null || typeof value === "boolean") {
173
- return;
174
- }
175
- resolveAndInsert(parent, value);
176
- }
177
- function __element(tag, props) {
178
- if (getIsHydrating()) {
179
- const claimed = claimElement(tag);
180
- if (claimed) {
181
- if (props && typeof process !== "undefined" && true) {
182
- for (const [key, value] of Object.entries(props)) {
183
- if (key === "role" || key.startsWith("aria-")) {
184
- const actual = claimed.getAttribute(key);
185
- if (actual !== value) {
186
- console.warn(`[hydrate] ARIA mismatch on <${tag}>: ${key}="${actual}" (expected "${value}")`);
187
- }
188
- }
189
- }
190
- }
191
- return claimed;
192
- }
193
- }
194
- const adapter = getAdapter();
195
- const svg = isSVGTag(tag);
196
- const el = svg ? adapter.createElementNS(SVG_NS, tag) : adapter.createElement(tag);
197
- if (props) {
198
- for (const [key, value] of Object.entries(props)) {
199
- const attrName = svg ? normalizeSVGAttr(key) : key;
200
- el.setAttribute(attrName, value);
201
- }
202
- }
203
- return el;
204
- }
205
- function __append(parent, child) {
206
- if (getIsHydrating())
207
- return;
208
- parent.appendChild(child);
209
- }
210
- function __staticText(text) {
211
- if (getIsHydrating()) {
212
- const claimed = claimText();
213
- if (claimed)
214
- return claimed;
215
- }
216
- return getAdapter().createTextNode(text);
217
- }
218
- function __enterChildren(el) {
219
- if (getIsHydrating()) {
220
- enterChildren(el);
221
- }
222
- }
223
- function __exitChildren() {
224
- if (getIsHydrating()) {
225
- exitChildren();
226
- }
227
- }
228
-
229
- export { __text, __child, __insert, __element, __append, __staticText, __enterChildren, __exitChildren };
@@ -1,40 +0,0 @@
1
- import {
2
- getSSRContext
3
- } from "./chunk-656n0x6y.js";
4
-
5
- // src/dom/dom-adapter.ts
6
- function createDOMAdapter() {
7
- return {
8
- createElement: (tag) => document.createElement(tag),
9
- createElementNS: (ns, tag) => document.createElementNS(ns, tag),
10
- createTextNode: (text) => document.createTextNode(text),
11
- createComment: (text) => document.createComment(text),
12
- createDocumentFragment: () => document.createDocumentFragment(),
13
- isNode: (value) => typeof Node !== "undefined" && value instanceof Node
14
- };
15
- }
16
-
17
- // src/dom/adapter.ts
18
- var RENDER_NODE_BRAND = Symbol.for("vertz:render-node");
19
- function isRenderNode(value) {
20
- if (value == null || typeof value !== "object")
21
- return false;
22
- if (RENDER_NODE_BRAND in value)
23
- return true;
24
- return typeof Node !== "undefined" && value instanceof Node;
25
- }
26
- var currentAdapter = null;
27
- function getAdapter() {
28
- const ctx = getSSRContext();
29
- if (ctx)
30
- return ctx.adapter;
31
- if (!currentAdapter) {
32
- currentAdapter = createDOMAdapter();
33
- }
34
- return currentAdapter;
35
- }
36
- function setAdapter(adapter) {
37
- currentAdapter = adapter;
38
- }
39
-
40
- export { createDOMAdapter, RENDER_NODE_BRAND, isRenderNode, getAdapter, setAdapter };
@@ -1,67 +0,0 @@
1
- // src/dom/svg-tags.ts
2
- var SVG_TAGS = new Set([
3
- "svg",
4
- "path",
5
- "circle",
6
- "ellipse",
7
- "rect",
8
- "line",
9
- "polyline",
10
- "polygon",
11
- "g",
12
- "defs",
13
- "symbol",
14
- "use",
15
- "text",
16
- "tspan",
17
- "image",
18
- "foreignObject",
19
- "filter",
20
- "feGaussianBlur",
21
- "feOffset",
22
- "feColorMatrix",
23
- "feBlend",
24
- "feMerge",
25
- "feMergeNode",
26
- "feComposite",
27
- "feFlood",
28
- "linearGradient",
29
- "radialGradient",
30
- "stop",
31
- "pattern",
32
- "clipPath",
33
- "mask",
34
- "animate",
35
- "animateTransform",
36
- "set",
37
- "marker",
38
- "desc"
39
- ]);
40
- var SVG_NS = "http://www.w3.org/2000/svg";
41
- function isSVGTag(tag) {
42
- return SVG_TAGS.has(tag);
43
- }
44
- var SVG_ATTR_MAP = {
45
- strokeWidth: "stroke-width",
46
- strokeLinecap: "stroke-linecap",
47
- strokeLinejoin: "stroke-linejoin",
48
- strokeDasharray: "stroke-dasharray",
49
- strokeDashoffset: "stroke-dashoffset",
50
- strokeOpacity: "stroke-opacity",
51
- fillOpacity: "fill-opacity",
52
- fillRule: "fill-rule",
53
- clipRule: "clip-rule",
54
- clipPath: "clip-path",
55
- stopColor: "stop-color",
56
- stopOpacity: "stop-opacity",
57
- floodColor: "flood-color",
58
- floodOpacity: "flood-opacity",
59
- colorInterpolation: "color-interpolation",
60
- colorInterpolationFilters: "color-interpolation-filters",
61
- viewBox: "viewBox"
62
- };
63
- function normalizeSVGAttr(attr) {
64
- return SVG_ATTR_MAP[attr] ?? attr;
65
- }
66
-
67
- export { SVG_NS, isSVGTag, normalizeSVGAttr };