@tempots/dom 33.1.1 → 34.1.0

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 (40) hide show
  1. package/dom/dom-context.d.ts +2 -9
  2. package/dom/dom-utils.d.ts +1 -0
  3. package/dom/headless-context.d.ts +1 -1
  4. package/index.cjs +1 -1
  5. package/index.d.ts +4 -8
  6. package/index.js +999 -970
  7. package/package.json +4 -1
  8. package/renderable/attribute.d.ts +20 -20
  9. package/renderable/bind.d.ts +1 -1
  10. package/renderable/conjunction.d.ts +1 -2
  11. package/renderable/domnode.d.ts +1 -1
  12. package/renderable/element.d.ts +8 -8
  13. package/renderable/empty.d.ts +2 -2
  14. package/renderable/ensure.d.ts +1 -2
  15. package/renderable/foreach.d.ts +1 -3
  16. package/renderable/fragment.d.ts +1 -1
  17. package/renderable/map-signal.d.ts +1 -1
  18. package/renderable/not-empty.d.ts +1 -2
  19. package/renderable/on-dispose.d.ts +2 -2
  20. package/renderable/oneof.d.ts +1 -2
  21. package/renderable/provider.d.ts +1 -1
  22. package/renderable/render.d.ts +2 -2
  23. package/renderable/repeat.d.ts +1 -2
  24. package/renderable/shadow-root.d.ts +9 -0
  25. package/renderable/task.d.ts +1 -1
  26. package/renderable/text.d.ts +1 -2
  27. package/renderable/utils.d.ts +1 -2
  28. package/renderable/when.d.ts +1 -1
  29. package/renderable/with-browser-ctx.d.ts +1 -1
  30. package/renderable/with-ctx.d.ts +1 -1
  31. package/renderable/with-headless-ctx.d.ts +1 -1
  32. package/renderable/with-scope.d.ts +1 -1
  33. package/types/domain.d.ts +44 -85
  34. package/std/disposal-scope.d.ts +0 -97
  35. package/std/element-position.d.ts +0 -64
  36. package/std/interpolate.d.ts +0 -56
  37. package/std/scope-stack.d.ts +0 -76
  38. package/std/signal-utils.d.ts +0 -301
  39. package/std/signal.d.ts +0 -605
  40. package/std/value.d.ts +0 -131
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/dom",
3
- "version": "33.1.1",
3
+ "version": "34.1.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -35,5 +35,8 @@
35
35
  "repository": {
36
36
  "type": "git",
37
37
  "url": "git+https://github.com/fponticelli/tempots.git"
38
+ },
39
+ "peerDependencies": {
40
+ "@tempots/core": "^1.0.0"
38
41
  }
39
42
  }
@@ -1,5 +1,5 @@
1
1
  import { Renderable, SplitNValue } from '../types/domain';
2
- import { Value } from '../std/value';
2
+ import { Value } from '@tempots/core';
3
3
  /**
4
4
  * Creates a renderable for an HTML attribute with the specified name and value.
5
5
  *
@@ -83,7 +83,7 @@ export declare const attr: {
83
83
  draggable: (value: SplitNValue<boolean | "true" | "false">) => Renderable;
84
84
  dropzone: (value: SplitNValue<string>) => Renderable;
85
85
  enctype: (value: SplitNValue<string>) => Renderable;
86
- enterkeyhint: (value: SplitNValue<"search" | "enter" | "done" | "go" | "next" | "previous" | "send">) => Renderable;
86
+ enterkeyhint: (value: SplitNValue<"enter" | "done" | "go" | "next" | "previous" | "search" | "send">) => Renderable;
87
87
  for: (value: SplitNValue<string>) => Renderable;
88
88
  form: (value: SplitNValue<string>) => Renderable;
89
89
  formaction: (value: SplitNValue<string>) => Renderable;
@@ -93,7 +93,7 @@ export declare const attr: {
93
93
  formtarget: (value: SplitNValue<string>) => Renderable;
94
94
  headers: (value: SplitNValue<string>) => Renderable;
95
95
  height: (value: SplitNValue<string>) => Renderable;
96
- hidden: (value: SplitNValue<boolean | "" | "hidden" | "until-found">) => Renderable;
96
+ hidden: (value: SplitNValue<boolean | "" | "until-found" | "hidden">) => Renderable;
97
97
  high: (value: SplitNValue<string>) => Renderable;
98
98
  href: (value: SplitNValue<string>) => Renderable;
99
99
  hreflang: (value: SplitNValue<string>) => Renderable;
@@ -141,7 +141,7 @@ export declare const attr: {
141
141
  playsinline: (value: SplitNValue<boolean>) => Renderable;
142
142
  popover: (value: SplitNValue<"" | "auto" | "manual">) => Renderable;
143
143
  popovertarget: (value: SplitNValue<string>) => Renderable;
144
- popovertargetaction: (value: SplitNValue<"toggle" | "hide" | "show">) => Renderable;
144
+ popovertargetaction: (value: SplitNValue<"hide" | "show" | "toggle">) => Renderable;
145
145
  poster: (value: SplitNValue<string>) => Renderable;
146
146
  preload: (value: SplitNValue<string>) => Renderable;
147
147
  property: (value: SplitNValue<string>) => Renderable;
@@ -344,7 +344,7 @@ export declare const SVGAttr: (name: string, value: unknown) => Renderable;
344
344
  export declare const svgAttr: {
345
345
  'accent-height': (value: SplitNValue<string | number>) => Renderable;
346
346
  accumulate: (value: SplitNValue<"none" | "sum">) => Renderable;
347
- additive: (value: SplitNValue<"replace" | "sum">) => Renderable;
347
+ additive: (value: SplitNValue<"sum" | "replace">) => Renderable;
348
348
  'alignment-baseline': (value: SplitNValue<"auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit">) => Renderable;
349
349
  'allow-reorder': (value: SplitNValue<"yes" | "no">) => Renderable;
350
350
  alphabetic: (value: SplitNValue<string | number>) => Renderable;
@@ -478,7 +478,7 @@ export declare const svgAttr: {
478
478
  orient: (value: SplitNValue<string | number>) => Renderable;
479
479
  orientation: (value: SplitNValue<"h" | "v">) => Renderable;
480
480
  origin: (value: SplitNValue<string>) => Renderable;
481
- overflow: (value: SplitNValue<"hidden" | "scroll" | "auto" | "inherit" | "visible">) => Renderable;
481
+ overflow: (value: SplitNValue<"auto" | "hidden" | "scroll" | "inherit" | "visible">) => Renderable;
482
482
  'overline-position': (value: SplitNValue<string | number>) => Renderable;
483
483
  'overline-thickness': (value: SplitNValue<string | number>) => Renderable;
484
484
  'paint-order': (value: SplitNValue<string>) => Renderable;
@@ -520,7 +520,7 @@ export declare const svgAttr: {
520
520
  specularConstant: (value: SplitNValue<string | number>) => Renderable;
521
521
  specularExponent: (value: SplitNValue<string | number>) => Renderable;
522
522
  speed: (value: SplitNValue<string | number>) => Renderable;
523
- spreadMethod: (value: SplitNValue<"repeat" | "pad" | "reflect">) => Renderable;
523
+ spreadMethod: (value: SplitNValue<"pad" | "reflect" | "repeat">) => Renderable;
524
524
  startOffset: (value: SplitNValue<string | number>) => Renderable;
525
525
  stdDeviation: (value: SplitNValue<string | number>) => Renderable;
526
526
  stemh: (value: SplitNValue<string | number>) => Renderable;
@@ -548,7 +548,7 @@ export declare const svgAttr: {
548
548
  targetX: (value: SplitNValue<string | number>) => Renderable;
549
549
  targetY: (value: SplitNValue<string | number>) => Renderable;
550
550
  'text-anchor': (value: SplitNValue<"middle" | "inherit" | "start" | "end">) => Renderable;
551
- 'text-decoration': (value: SplitNValue<"none" | "blink" | "inherit" | "underline" | "overline" | "line-through">) => Renderable;
551
+ 'text-decoration': (value: SplitNValue<"none" | "inherit" | "underline" | "overline" | "line-through" | "blink">) => Renderable;
552
552
  textLength: (value: SplitNValue<string | number>) => Renderable;
553
553
  'text-rendering': (value: SplitNValue<"auto" | "inherit" | "optimizeSpeed" | "geometricPrecision" | "optimizeLegibility">) => Renderable;
554
554
  title: (value: SplitNValue<string>) => Renderable;
@@ -561,7 +561,7 @@ export declare const svgAttr: {
561
561
  'underline-position': (value: SplitNValue<string | number>) => Renderable;
562
562
  'underline-thickness': (value: SplitNValue<string | number>) => Renderable;
563
563
  unicode: (value: SplitNValue<string>) => Renderable;
564
- 'unicode-bidi': (value: SplitNValue<"embed" | "plaintext" | "normal" | "inherit" | "isolate" | "bidi-override" | "isolate-override">) => Renderable;
564
+ 'unicode-bidi': (value: SplitNValue<"normal" | "inherit" | "embed" | "isolate" | "bidi-override" | "isolate-override" | "plaintext">) => Renderable;
565
565
  'unicode-range': (value: SplitNValue<string>) => Renderable;
566
566
  'units-per-em': (value: SplitNValue<string | number>) => Renderable;
567
567
  'v-alphabetic': (value: SplitNValue<string | number>) => Renderable;
@@ -590,16 +590,16 @@ export declare const svgAttr: {
590
590
  'xlink:arcrole': (value: SplitNValue<string>) => Renderable;
591
591
  'xlink:href': (value: SplitNValue<string>) => Renderable;
592
592
  'xlink:role': (value: SplitNValue<string>) => Renderable;
593
- 'xlink:show': (value: SplitNValue<"none" | "other" | "embed" | "replace" | "new">) => Renderable;
593
+ 'xlink:show': (value: SplitNValue<"none" | "other" | "replace" | "embed" | "new">) => Renderable;
594
594
  'xlink:title': (value: SplitNValue<string>) => Renderable;
595
- 'xlink:type': (value: SplitNValue<"none" | "title" | "simple" | "extended" | "locator" | "arc" | "resource">) => Renderable;
595
+ 'xlink:type': (value: SplitNValue<"none" | "simple" | "extended" | "locator" | "arc" | "resource" | "title">) => Renderable;
596
596
  xlinkActuate: (value: SplitNValue<"none" | "other" | "onLoad" | "onRequest">) => Renderable;
597
597
  xlinkArcrole: (value: SplitNValue<string>) => Renderable;
598
598
  xlinkHref: (value: SplitNValue<string>) => Renderable;
599
599
  xlinkRole: (value: SplitNValue<string>) => Renderable;
600
- xlinkShow: (value: SplitNValue<"none" | "other" | "embed" | "replace" | "new">) => Renderable;
600
+ xlinkShow: (value: SplitNValue<"none" | "other" | "replace" | "embed" | "new">) => Renderable;
601
601
  xlinkTitle: (value: SplitNValue<string>) => Renderable;
602
- xlinkType: (value: SplitNValue<"none" | "title" | "simple" | "extended" | "locator" | "arc" | "resource">) => Renderable;
602
+ xlinkType: (value: SplitNValue<"none" | "simple" | "extended" | "locator" | "arc" | "resource" | "title">) => Renderable;
603
603
  'xml:base': (value: SplitNValue<string>) => Renderable;
604
604
  'xml:lang': (value: SplitNValue<string>) => Renderable;
605
605
  'xml:space': (value: SplitNValue<"default" | "preserve">) => Renderable;
@@ -650,7 +650,7 @@ export declare const MathAttr: (name: string, value: unknown) => Renderable;
650
650
  export declare const mathAttr: {
651
651
  accent: (value: SplitNValue<string | boolean>) => Renderable;
652
652
  accentunder: (value: SplitNValue<string | boolean>) => Renderable;
653
- actiontype: (value: SplitNValue<"input" | "statusline" | "tooltip">) => Renderable;
653
+ actiontype: (value: SplitNValue<"statusline" | "tooltip" | "input">) => Renderable;
654
654
  align: (value: SplitNValue<"left" | "right" | "center">) => Renderable;
655
655
  altimg: (value: SplitNValue<string>) => Renderable;
656
656
  altimgheight: (value: SplitNValue<string>) => Renderable;
@@ -685,16 +685,16 @@ export declare const mathAttr: {
685
685
  fontfamily: (value: SplitNValue<string>) => Renderable;
686
686
  fontsize: (value: SplitNValue<string>) => Renderable;
687
687
  fontstyle: (value: SplitNValue<"normal" | "italic">) => Renderable;
688
- fontweight: (value: SplitNValue<"bold" | "normal">) => Renderable;
688
+ fontweight: (value: SplitNValue<"normal" | "bold">) => Renderable;
689
689
  form: (value: SplitNValue<"prefix" | "infix" | "postfix">) => Renderable;
690
690
  frame: (value: SplitNValue<string>) => Renderable;
691
691
  groupalign: (value: SplitNValue<string>) => Renderable;
692
692
  height: (value: SplitNValue<string>) => Renderable;
693
693
  href: (value: SplitNValue<string>) => Renderable;
694
694
  id: (value: SplitNValue<string>) => Renderable;
695
- indentalign: (value: SplitNValue<"left" | "right" | "center" | "id" | "auto">) => Renderable;
696
- indentalignfirst: (value: SplitNValue<"left" | "right" | "center" | "id" | "auto" | "indentaling">) => Renderable;
697
- indentalignlast: (value: SplitNValue<"left" | "right" | "center" | "id" | "auto" | "indentaling">) => Renderable;
695
+ indentalign: (value: SplitNValue<"left" | "right" | "auto" | "center" | "id">) => Renderable;
696
+ indentalignfirst: (value: SplitNValue<"left" | "right" | "auto" | "center" | "id" | "indentaling">) => Renderable;
697
+ indentalignlast: (value: SplitNValue<"left" | "right" | "auto" | "center" | "id" | "indentaling">) => Renderable;
698
698
  indentshift: (value: SplitNValue<string>) => Renderable;
699
699
  indentshiftfirst: (value: SplitNValue<string>) => Renderable;
700
700
  indentshiftlast: (value: SplitNValue<string>) => Renderable;
@@ -717,7 +717,7 @@ export declare const mathAttr: {
717
717
  mathcolor: (value: SplitNValue<string>) => Renderable;
718
718
  mathdepth: (value: SplitNValue<string>) => Renderable;
719
719
  mathsize: (value: SplitNValue<string>) => Renderable;
720
- mathvariant: (value: SplitNValue<"script" | "bold" | "normal" | "italic" | "bold-italic" | "double-struck" | "bold-fraktur" | "bold-script" | "fraktur" | "sans-serif" | "bold-sans-serif" | "sans-serif-italic" | "sans-serif-bold-italic" | "monospace" | "initial" | "tailed" | "looped" | "stretched">) => Renderable;
720
+ mathvariant: (value: SplitNValue<"normal" | "italic" | "bold" | "bold-italic" | "double-struck" | "bold-fraktur" | "script" | "bold-script" | "fraktur" | "sans-serif" | "bold-sans-serif" | "sans-serif-italic" | "sans-serif-bold-italic" | "monospace" | "initial" | "tailed" | "looped" | "stretched">) => Renderable;
721
721
  maxsize: (value: SplitNValue<string>) => Renderable;
722
722
  maxwidth: (value: SplitNValue<string>) => Renderable;
723
723
  minlabelspacing: (value: SplitNValue<string>) => Renderable;
@@ -728,7 +728,7 @@ export declare const mathAttr: {
728
728
  numalign: (value: SplitNValue<"left" | "right" | "center">) => Renderable;
729
729
  open: (value: SplitNValue<string>) => Renderable;
730
730
  other: (value: SplitNValue<string>) => Renderable;
731
- overflow: (value: SplitNValue<"scale" | "scroll" | "linebreak" | "elide" | "truncate">) => Renderable;
731
+ overflow: (value: SplitNValue<"scale" | "linebreak" | "scroll" | "elide" | "truncate">) => Renderable;
732
732
  position: (value: SplitNValue<string>) => Renderable;
733
733
  rightoverhang: (value: SplitNValue<string>) => Renderable;
734
734
  rowalign: (value: SplitNValue<string>) => Renderable;
@@ -1,4 +1,4 @@
1
- import { Prop } from '../std/signal';
1
+ import { Prop } from '@tempots/core';
2
2
  import { Renderable } from '../types/domain';
3
3
  import { on } from './on';
4
4
  /**
@@ -1,6 +1,5 @@
1
- import { Signal } from '../std/signal';
1
+ import { Signal, ElementPosition } from '@tempots/core';
2
2
  import { Renderable, TNode } from '../types/domain';
3
- import { ElementPosition } from '../std/element-position';
4
3
  /**
5
4
  * Options for configuring a conjunction.
6
5
  * @public
@@ -5,7 +5,7 @@ import { Renderable } from '../types/domain';
5
5
  *
6
6
  * @param node - The DOM node to render.
7
7
  * @param ctx - The DOM context to render the node in.
8
- * @returns A function that can be called to remove the rendered node from the DOM.
8
+ * @returns A renderable object that can be used to remove the rendered node from the DOM.
9
9
  * @public
10
10
  */
11
11
  export declare const DOMNode: (node: Node) => Renderable<BrowserContext>;
@@ -12,17 +12,17 @@ export declare const renderableOfTNode: <T extends DOMContext>(child: TNode<T>)
12
12
  *
13
13
  * @param tagName - The tag name of the HTML element.
14
14
  * @param children - The child nodes of the HTML element.
15
- * @returns A renderable function that creates and appends the HTML element to the DOM.
15
+ * @returns A renderable object that creates and appends the HTML element to the DOM.
16
16
  * @public
17
17
  */
18
18
  export declare const El: (tagName: string, ...children: TNode[]) => Renderable;
19
19
  /**
20
- * Creates a renderable function that represents an element in the DOM with a specified namespace.
20
+ * Creates a renderable object that represents an element in the DOM with a specified namespace.
21
21
  *
22
22
  * @param tagName - The name of the HTML tag for the element.
23
23
  * @param namespace - The namespace of the element.
24
24
  * @param children - The child nodes of the element.
25
- * @returns A renderable function that creates and appends the element to the DOM.
25
+ * @returns A renderable object that creates and appends the element to the DOM.
26
26
  * @public
27
27
  */
28
28
  export declare const ElNS: (tagName: string, namespace: string, ...children: TNode[]) => Renderable;
@@ -165,12 +165,8 @@ export declare const input: {
165
165
  time: (...children: TNode[]) => Renderable;
166
166
  text: (...children: TNode[]) => Renderable;
167
167
  color: (...children: TNode[]) => Renderable;
168
- hidden: (...children: TNode[]) => Renderable;
169
- button: (...children: TNode[]) => Renderable;
170
168
  search: (...children: TNode[]) => Renderable;
171
- image: (...children: TNode[]) => Renderable;
172
- reset: (...children: TNode[]) => Renderable;
173
- submit: (...children: TNode[]) => Renderable;
169
+ hidden: (...children: TNode[]) => Renderable;
174
170
  tel: (...children: TNode[]) => Renderable;
175
171
  email: (...children: TNode[]) => Renderable;
176
172
  url: (...children: TNode[]) => Renderable;
@@ -178,7 +174,11 @@ export declare const input: {
178
174
  radio: (...children: TNode[]) => Renderable;
179
175
  file: (...children: TNode[]) => Renderable;
180
176
  password: (...children: TNode[]) => Renderable;
177
+ button: (...children: TNode[]) => Renderable;
178
+ submit: (...children: TNode[]) => Renderable;
179
+ reset: (...children: TNode[]) => Renderable;
181
180
  range: (...children: TNode[]) => Renderable;
181
+ image: (...children: TNode[]) => Renderable;
182
182
  month: (...children: TNode[]) => Renderable;
183
183
  week: (...children: TNode[]) => Renderable;
184
184
  "datetime-local": (...children: TNode[]) => Renderable;
@@ -1,7 +1,7 @@
1
1
  import { Renderable } from '../types/domain';
2
2
  /**
3
- * Represents an empty renderable function.
4
- * @returns A renderable function that does nothing.
3
+ * Represents an empty renderable object.
4
+ * @returns A renderable object that does nothing.
5
5
  * @public
6
6
  */
7
7
  export declare const Empty: Renderable;
@@ -1,6 +1,5 @@
1
1
  import { TNode, Renderable } from '../types/domain';
2
- import { Signal } from '../std/signal';
3
- import { Value } from '../std/value';
2
+ import { Signal, Value } from '@tempots/core';
4
3
  export type NillifyValue<T> = Value<T | null | undefined> | Value<T | undefined> | Value<T | null>;
5
4
  export type Id<T> = {} & {
6
5
  [P in keyof T]: T[P];
@@ -1,7 +1,5 @@
1
1
  import { TNode, Renderable } from '../types/domain';
2
- import { Signal } from '../std/signal';
3
- import { ElementPosition } from '../std/element-position';
4
- import { Value } from '../std/value';
2
+ import { Signal, Value, ElementPosition } from '@tempots/core';
5
3
  /**
6
4
  * Efficiently renders a dynamic list of items from an array signal.
7
5
  *
@@ -8,7 +8,7 @@ import { DOMContext } from '../dom/dom-context';
8
8
  * It can be used any time a single Renderable/TNode is expected, but multiple renderables are needed.
9
9
  *
10
10
  * @param children - The child renderables to include in the fragment.
11
- * @returns A renderable function that renders the child renderables in the given DOM context.
11
+ * @returns A renderable object that renders the child renderables in the given DOM context.
12
12
  * @public
13
13
  */
14
14
  export declare const Fragment: <T extends DOMContext>(...children: TNode<T>[]) => Renderable<T>;
@@ -1,5 +1,5 @@
1
1
  import { Renderable, TNode } from '../types/domain';
2
- import { Value } from '../std/value';
2
+ import { Value } from '@tempots/core';
3
3
  /**
4
4
  * Maps the values emitted by a signal to a renderable function and returns a new renderable function.
5
5
  *
@@ -1,5 +1,4 @@
1
- import { Signal } from '../std/signal';
2
- import { Value } from '../std/value';
1
+ import { Signal, Value } from '@tempots/core';
3
2
  import { Renderable } from '../types/domain';
4
3
  /**
5
4
  * Returns a renderable component that displays the given `display` component
@@ -5,9 +5,9 @@ export type WithDispose = {
5
5
  dispose: DisposeCallback;
6
6
  };
7
7
  /**
8
- * Creates a renderable function that will be called when the component is unmounted.
8
+ * Creates a renderable object that will be called when the component is unmounted.
9
9
  * @param fns - The function(s) to be called when the component is unmounted.
10
- * @returns A renderable function that takes a DOMContext and returns a function that takes a boolean indicating whether to remove the tree.
10
+ * @returns A renderable object that takes a DOMContext and returns a function that takes a boolean indicating whether to remove the tree.
11
11
  * @public
12
12
  */
13
13
  export declare const OnDispose: (...fns: (DisposeCallback | WithDispose)[]) => Renderable;
@@ -1,5 +1,4 @@
1
- import { Signal } from '../std/signal';
2
- import { Value } from '../std/value';
1
+ import { Signal, Value } from '@tempots/core';
3
2
  import { Renderable, TNode } from '../types/domain';
4
3
  /**
5
4
  * Represents a set of options for a one-of type.
@@ -30,7 +30,7 @@ export type ProviderOptions = {
30
30
  set: <T, O = any>(provider: Provider<T, O>, options?: O) => void;
31
31
  };
32
32
  /**
33
- * Returns a renderable function that executes the given function with the
33
+ * Returns a renderable object that executes the given function with the
34
34
  * current DOMContext as argument.
35
35
  * The given function can return a TNode or void. If you need to perform some
36
36
  * actions when the Renderable is disposed, you can use `OnDispose` as the
@@ -1,7 +1,7 @@
1
1
  import { Providers, Renderable } from '../types/domain';
2
2
  import { DOMContext } from '../dom/dom-context';
3
3
  import { HeadlessPortal } from '../dom/headless-context';
4
- import { Value } from '../std/value';
4
+ import { Value } from '@tempots/core';
5
5
  /**
6
6
  * Renders the given `renderable` with the provided `ctx` DOM context.
7
7
  *
@@ -79,7 +79,7 @@ export type HeadlessOptions = {
79
79
  export declare const runHeadless: (makeRenderable: () => Renderable, { startUrl, selector, providers, }?: HeadlessOptions) => {
80
80
  clear: (removeTree?: boolean) => void;
81
81
  root: HeadlessPortal;
82
- currentURL: import('..').Prop<string>;
82
+ currentURL: import('@tempots/core').Prop<string>;
83
83
  };
84
84
  /**
85
85
  * Represents an error that occurs during rendering.
@@ -1,5 +1,4 @@
1
- import { ElementPosition } from '../std/element-position';
2
- import { Value } from '../std/value';
1
+ import { ElementPosition, Value } from '@tempots/core';
3
2
  import { TNode, Renderable } from '../types/domain';
4
3
  /**
5
4
  * Renders content a specified number of times, with each iteration receiving position information.
@@ -0,0 +1,9 @@
1
+ import { TNode } from '../types/domain';
2
+ export interface ShadowRootOptions {
3
+ mode: 'open' | 'closed';
4
+ delegatesFocus?: boolean;
5
+ slotAssignment?: 'named' | 'manual';
6
+ clonable?: boolean;
7
+ serializable?: boolean;
8
+ }
9
+ export declare function ShadowRoot({ mode, delegatesFocus, slotAssignment, clonable, serializable, }: ShadowRootOptions, ...children: TNode[]): import('..').Renderable;
@@ -16,7 +16,7 @@ export type TaskOptions<T> = {
16
16
  * @typeParam T - The type of the value returned by the task.
17
17
  * @param task - The asynchronous task to be executed.
18
18
  * @param options - The options for the task or a function that transforms the task result into a renderable node.
19
- * @returns - A function that renders the task and returns a cleanup function.
19
+ * @returns - A renderable object that renders the task and returns a cleanup function.
20
20
  * @public
21
21
  */
22
22
  export declare const Task: <T>(task: () => Promise<T>, options: TaskOptions<T> | ((value: T) => TNode)) => Renderable;
@@ -1,6 +1,5 @@
1
1
  import { Renderable } from '../types/domain';
2
- import { Signal } from '../std/signal';
3
- import { Value } from '../std/value';
2
+ import { Signal, Value } from '@tempots/core';
4
3
  /**
5
4
  * @internal
6
5
  */
@@ -1,7 +1,6 @@
1
1
  import { Clear, TNode } from '../types/domain';
2
2
  import { DOMContext } from '../dom/dom-context';
3
- import { Signal } from '../std/signal';
4
- import { Value } from '../std/value';
3
+ import { Signal, Value } from '@tempots/core';
5
4
  /**
6
5
  * Helper function to handle a value that could be either a Signal or a static value.
7
6
  * Delegates to the appropriate handler based on whether the value is a Signal.
@@ -1,5 +1,5 @@
1
1
  import { Renderable, TNode } from '../types/domain';
2
- import { Value } from '../std/value';
2
+ import { Value } from '@tempots/core';
3
3
  /**
4
4
  * Lazily renders content based on a boolean condition.
5
5
  * @param condition - The condition to evaluate
@@ -1,7 +1,7 @@
1
1
  import { BrowserContext } from '../dom/browser-context';
2
2
  import { Renderable, TNode } from '../types/domain';
3
3
  /**
4
- * Returns a renderable function that executes the given function with the
4
+ * Returns a renderable object that executes the given function with the
5
5
  * current DOMContext as argument.
6
6
  * The given function can return a TNode or void. If you need to perform some
7
7
  * actions when the Renderable is disposed, you can use `OnDispose` as the
@@ -1,7 +1,7 @@
1
1
  import { DOMContext } from '../dom/dom-context';
2
2
  import { Renderable, TNode } from '../types/domain';
3
3
  /**
4
- * Returns a renderable function that executes the given function with the
4
+ * Returns a renderable object that executes the given function with the
5
5
  * current DOMContext as argument.
6
6
  * The given function can return a TNode or void. If you need to perform some
7
7
  * actions when the Renderable is disposed, you can use `OnDispose` as the
@@ -1,7 +1,7 @@
1
1
  import { HeadlessContext } from '../dom/headless-context';
2
2
  import { Renderable, TNode } from '../types/domain';
3
3
  /**
4
- * Returns a renderable function that executes the given function with the current DOMContext as argument.
4
+ * Returns a renderable object that executes the given function with the current DOMContext as argument.
5
5
  *
6
6
  * @param fn - The function to be executed with the DOMContext argument.
7
7
  * @returns A Clear function that can be used to clean up any resources associated with the execution.
@@ -1,4 +1,4 @@
1
- import { DisposalScope } from '../std/disposal-scope';
1
+ import { DisposalScope } from '@tempots/core';
2
2
  import { Renderable, TNode } from '../types/domain';
3
3
  /**
4
4
  * Creates a renderable that provides explicit access to a DisposalScope.
package/types/domain.d.ts CHANGED
@@ -1,25 +1,35 @@
1
1
  import { DOMContext } from '../dom/dom-context';
2
- import { AnySignal, Computed, Prop, Signal } from '../std/signal';
3
- import { Value } from '../std/value';
2
+ import { AnySignal, Computed, Prop, Signal, Value, ValueType, BaseValueType, ValueTypes, Values, RemoveSignals, Nil, Clear, ProviderMark, makeProviderMark, Renderable as CoreRenderable } from '@tempots/core';
3
+ export type { Clear, ProviderMark, Value, ValueType, BaseValueType, ValueTypes, Values, RemoveSignals, Nil, AnySignal, Signal, Prop, Computed, };
4
+ export { makeProviderMark };
4
5
  /**
5
- * A function that renders content into the DOM and returns a cleanup function.
6
+ * Symbol to brand DOM renderables and prevent mixing with other contexts
7
+ * @public
8
+ */
9
+ export declare const DOM_RENDERABLE_TYPE: unique symbol;
10
+ /**
11
+ * A renderable object that can render content into the DOM.
6
12
  *
7
- * Renderables are the fundamental building blocks of Tempo applications. They receive
8
- * a DOMContext and use it to create DOM elements, text nodes, or other content.
9
- * The returned Clear function is called when the renderable needs to be removed
10
- * from the DOM.
13
+ * Renderables are the fundamental building blocks of Tempo applications. They are
14
+ * objects with a `render()` method that receives a DOMContext and returns a cleanup
15
+ * function, and a `type` symbol for runtime type checking.
16
+ *
17
+ * This is a specialized version of the core Renderable type for DOM contexts.
11
18
  *
12
19
  * @example
13
20
  * ```typescript
14
21
  * // Simple renderable that creates a div
15
- * const MyComponent: Renderable = (ctx) => {
16
- * const divCtx = ctx.makeChildElement('div', undefined)
17
- * divCtx.makeChildText('Hello, World!')
18
- *
19
- * // Return cleanup function
20
- * return (removeTree) => {
21
- * if (removeTree) {
22
- * // Cleanup logic here
22
+ * const MyComponent: Renderable = {
23
+ * type: DOM_RENDERABLE_TYPE,
24
+ * render: (ctx) => {
25
+ * const divCtx = ctx.makeChildElement('div', undefined)
26
+ * divCtx.makeChildText('Hello, World!')
27
+ *
28
+ * // Return cleanup function
29
+ * return (removeTree) => {
30
+ * if (removeTree) {
31
+ * // Cleanup logic here
32
+ * }
23
33
  * }
24
34
  * }
25
35
  * }
@@ -28,26 +38,32 @@ import { Value } from '../std/value';
28
38
  * @example
29
39
  * ```typescript
30
40
  * // Renderable with event listeners
31
- * const Button: Renderable = (ctx) => {
32
- * const buttonCtx = ctx.makeChildElement('button', undefined)
33
- * buttonCtx.makeChildText('Click me')
34
- *
35
- * const clearClick = buttonCtx.on('click', () => {
36
- * console.log('Button clicked!')
37
- * })
38
- *
39
- * return (removeTree) => {
40
- * clearClick(removeTree)
41
+ * const Button: Renderable = {
42
+ * type: DOM_RENDERABLE_TYPE,
43
+ * render: (ctx) => {
44
+ * const buttonCtx = ctx.makeChildElement('button', undefined)
45
+ * buttonCtx.makeChildText('Click me')
46
+ *
47
+ * const clearClick = buttonCtx.on('click', () => {
48
+ * console.log('Button clicked!')
49
+ * })
50
+ *
51
+ * return (removeTree) => {
52
+ * clearClick(removeTree)
53
+ * }
41
54
  * }
42
55
  * }
43
56
  * ```
44
57
  *
45
58
  * @template CTX - The type of DOMContext (defaults to DOMContext)
46
- * @param ctx - The DOM context for rendering
47
- * @returns A cleanup function that removes the rendered content when called
48
59
  * @public
49
60
  */
50
- export type Renderable<CTX extends DOMContext = DOMContext> = (ctx: CTX) => Clear;
61
+ export type Renderable<CTX extends DOMContext = DOMContext> = CoreRenderable<CTX, typeof DOM_RENDERABLE_TYPE>;
62
+ /**
63
+ * Helper to create DOM renderables (internal use)
64
+ * @internal
65
+ */
66
+ export declare const domRenderable: <CTX extends DOMContext = DOMContext>(renderFn: (ctx: CTX) => Clear) => Renderable<CTX>;
51
67
  /**
52
68
  * A flexible type representing any content that can be rendered in Tempo.
53
69
  *
@@ -112,20 +128,6 @@ export type Renderable<CTX extends DOMContext = DOMContext> = (ctx: CTX) => Clea
112
128
  * @public
113
129
  */
114
130
  export type TNode<CTX extends DOMContext = DOMContext> = Renderable<CTX> | Value<string> | undefined | null | Renderable<CTX>[];
115
- /**
116
- * Represents a function that clears a resource.
117
- * @param removeTree - A boolean value indicating whether to remove the tree associated with the resource.
118
- * @public
119
- */
120
- export type Clear = (removeTree: boolean) => void;
121
- /**
122
- * Represents a provider mark.
123
- * @typeParam T - The type of the mark.
124
- * @public
125
- */
126
- export type ProviderMark<T> = symbol & {
127
- readonly __type: T;
128
- };
129
131
  /**
130
132
  * Represents a collection of providers.
131
133
  * The keys of the record are ProviderMark types, and the values are of unknown type.
@@ -157,46 +159,3 @@ export type Size = {
157
159
  export type NValue<T> = Value<NonNullable<T>> | AnySignal<T> | AnySignal<T | null> | AnySignal<T | undefined> | AnySignal<T | null | undefined> | null | undefined;
158
160
  type TupleToUnion<T extends unknown[]> = T[number];
159
161
  export type SplitNValue<T> = (T extends unknown ? TupleToUnion<NValue<T>[]> : never) | NValue<T>;
160
- /**
161
- * Gets the value type of a given Value type.
162
- * If the type is a `Signal`, it returns the inferred value type.
163
- * Otherwise, it returns the type itself.
164
- * @public
165
- */
166
- export type ValueType<T> = T extends Computed<infer V> ? V : T extends Prop<infer V> ? V : T extends Signal<infer V> ? V : T;
167
- /**
168
- * Gets the base value type of a given Value type.
169
- * @public
170
- */
171
- export type BaseValueType<T> = NonNullable<ValueType<T>>;
172
- /**
173
- * Gets the value types of a given array of Value types.
174
- * @public
175
- */
176
- export type ValueTypes<T extends Value<unknown>[]> = {
177
- [K in keyof T]: ValueType<T[K]>;
178
- };
179
- /**
180
- * Wraps all non-`Value` types in the array in `Value`.
181
- * @public
182
- */
183
- export type Values<T extends unknown[]> = {
184
- [K in keyof T]: T[K] extends Signal<unknown> | Computed<unknown> | Prop<unknown> ? T[K] : Value<T[K]>;
185
- };
186
- /**
187
- * Removes signals from a given object type and returns a new object type
188
- * with only the non-signal properties.
189
- *
190
- * @typeParam T - The input object type.
191
- * @typeParam K - The keys of the input object type to keep (optional).
192
- * @public
193
- */
194
- export type RemoveSignals<T extends Record<string | number | symbol, Value<unknown>>, K extends (string | number | symbol) & keyof T = keyof T> = {
195
- [k in K]: ValueType<T[k]>;
196
- };
197
- /**
198
- * Represents a value that can be null or undefined.
199
- * @public
200
- */
201
- export type Nil = null | undefined;
202
- export {};