@panyam/tsappkit-solid 0.7.3 → 0.7.5

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/index.d.mts CHANGED
@@ -48,4 +48,15 @@ declare class SolidIsland extends BaseComponent {
48
48
  */
49
49
  declare function signalView<S>(initial: S): [Accessor<S>, (next: S) => void];
50
50
 
51
- export { SolidIsland, signalView };
51
+ /**
52
+ * Attaches `view` to a presenter's port for as long as the current Solid owner
53
+ * lives. Called from a SolidIsland's render function, that's from the island's
54
+ * activate to its deactivate, so a presenter never calls into an island that
55
+ * has gone. The port is typed structurally so this works with tsappkit's Port
56
+ * or anything with the same attach.
57
+ */
58
+ declare function useView<V>(port: {
59
+ attach(view: V): () => void;
60
+ }, view: V): void;
61
+
62
+ export { SolidIsland, signalView, useView };
package/dist/index.d.ts CHANGED
@@ -48,4 +48,15 @@ declare class SolidIsland extends BaseComponent {
48
48
  */
49
49
  declare function signalView<S>(initial: S): [Accessor<S>, (next: S) => void];
50
50
 
51
- export { SolidIsland, signalView };
51
+ /**
52
+ * Attaches `view` to a presenter's port for as long as the current Solid owner
53
+ * lives. Called from a SolidIsland's render function, that's from the island's
54
+ * activate to its deactivate, so a presenter never calls into an island that
55
+ * has gone. The port is typed structurally so this works with tsappkit's Port
56
+ * or anything with the same attach.
57
+ */
58
+ declare function useView<V>(port: {
59
+ attach(view: V): () => void;
60
+ }, view: V): void;
61
+
62
+ export { SolidIsland, signalView, useView };
package/dist/index.js CHANGED
@@ -34,8 +34,12 @@ function signalView(initial) {
34
34
  const [value, setValue] = solidJs.createSignal(initial);
35
35
  return [value, (next) => setValue(() => next)];
36
36
  }
37
+ function useView(port, view) {
38
+ solidJs.onCleanup(port.attach(view));
39
+ }
37
40
 
38
41
  exports.SolidIsland = SolidIsland;
39
42
  exports.signalView = signalView;
43
+ exports.useView = useView;
40
44
  //# sourceMappingURL=index.js.map
41
45
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts"],"names":["BaseComponent","render","createSignal"],"mappings":";;;;;;;AAqBO,IAAM,WAAA,GAAN,cAA0BA,sBAAA,CAAc;AAAA,EAG7C,YACE,WAAA,EACA,WAAA,EACiB,YACjB,QAAA,GAA4B,IAAA,EAC5B,YAAqB,KAAA,EACrB;AACA,IAAA,KAAA,CAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAU,SAAS,CAAA;AAJlC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAKnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,GAAiB;AACtB,IAAA,IAAI,KAAK,WAAA,EAAa;AACtB,IAAA,IAAA,CAAK,YAAY,eAAA,EAAgB;AACjC,IAAA,IAAA,CAAK,WAAA,GAAcC,UAAA,CAAO,IAAA,CAAK,UAAA,EAAY,KAAK,WAAW,CAAA;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAA,GAAmB;AACxB,IAAA,IAAA,CAAK,WAAA,IAAc;AACnB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,IAAA,KAAA,CAAM,UAAA,EAAW;AAAA,EACnB;AACF;ACzCO,SAAS,WAAc,OAAA,EAA8C;AAC1E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIC,qBAAgB,OAAO,CAAA;AACjD,EAAA,OAAO,CAAC,KAAA,EAAO,CAAC,SAAY,QAAA,CAAS,MAAM,IAAI,CAAC,CAAA;AAClD","file":"index.js","sourcesContent":["import { render } from 'solid-js/web';\nimport type { JSX } from 'solid-js';\nimport { BaseComponent, EventBus } from '@panyam/tsappkit';\n\n/**\n * Mounts a Solid tree inside the tsappkit component lifecycle.\n *\n * The Solid root is created in `activate`, not the constructor, so the render\n * function can close over dependencies injected during `setupDependencies`\n * (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's\n * `onCleanup` handlers and removes the inserted nodes.\n *\n * The island owns all of its `rootElement`'s children while active, so give it\n * a dedicated element (an island page's `data-slot`). Whatever was there\n * before, such as the skeleton or `<noscript>` line Go rendered as the slot's\n * fallback, is removed on the first `activate`, in the same task that renders\n * the tree, so the slot never shows empty. Solid's `render` appends rather\n * than replacing, which is why this clears first. This class is the only place\n * framework (Solid) reactivity lives; tsappkit core and any presenter behind\n * it stay framework-neutral.\n */\nexport class SolidIsland extends BaseComponent {\n private disposeRoot?: () => void;\n\n constructor(\n componentId: string,\n rootElement: HTMLElement,\n private readonly renderRoot: () => JSX.Element,\n eventBus: EventBus | null = null,\n debugMode: boolean = false,\n ) {\n super(componentId, rootElement, eventBus, debugMode);\n }\n\n /**\n * Replace `rootElement`'s children with the Solid tree. Idempotent: calling\n * it again while already mounted is a no-op (the existing root is kept, not\n * cleared or remounted).\n */\n public activate(): void {\n if (this.disposeRoot) return;\n this.rootElement.replaceChildren();\n this.disposeRoot = render(this.renderRoot, this.rootElement);\n }\n\n /**\n * Dispose the Solid tree (runs `onCleanup`, removes the inserted nodes), then\n * defer to the base cleanup (clears the `data-component` marker).\n */\n public deactivate(): void {\n this.disposeRoot?.();\n this.disposeRoot = undefined;\n super.deactivate();\n }\n}\n","import { createSignal, type Accessor } from 'solid-js';\n\n/**\n * Create a Solid-backed cell for the \"typed view-interface method backed by a\n * signal\" pattern: the accessor drives JSX, the returned setter is the\n * command-down method a framework-agnostic presenter calls.\n *\n * The setter always writes via the updater form (`set(() => next)`) rather than\n * `set(next)`. Solid treats a function passed to a signal setter as an updater\n * to run, not a value to store, so a plain `set(next)` would be wrong whenever\n * `S` is itself a function type. Wrapping makes `signalView` a correct\n * \"replace the value\" setter for any `S`.\n */\nexport function signalView<S>(initial: S): [Accessor<S>, (next: S) => void] {\n const [value, setValue] = createSignal<S>(initial);\n return [value, (next: S) => setValue(() => next)];\n}\n"]}
1
+ {"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts","../src/useView.ts"],"names":["BaseComponent","render","createSignal","onCleanup"],"mappings":";;;;;;;AAqBO,IAAM,WAAA,GAAN,cAA0BA,sBAAA,CAAc;AAAA,EAG7C,YACE,WAAA,EACA,WAAA,EACiB,YACjB,QAAA,GAA4B,IAAA,EAC5B,YAAqB,KAAA,EACrB;AACA,IAAA,KAAA,CAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAU,SAAS,CAAA;AAJlC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAKnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,GAAiB;AACtB,IAAA,IAAI,KAAK,WAAA,EAAa;AACtB,IAAA,IAAA,CAAK,YAAY,eAAA,EAAgB;AACjC,IAAA,IAAA,CAAK,WAAA,GAAcC,UAAA,CAAO,IAAA,CAAK,UAAA,EAAY,KAAK,WAAW,CAAA;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAA,GAAmB;AACxB,IAAA,IAAA,CAAK,WAAA,IAAc;AACnB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,IAAA,KAAA,CAAM,UAAA,EAAW;AAAA,EACnB;AACF;ACzCO,SAAS,WAAc,OAAA,EAA8C;AAC1E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIC,qBAAgB,OAAO,CAAA;AACjD,EAAA,OAAO,CAAC,KAAA,EAAO,CAAC,SAAY,QAAA,CAAS,MAAM,IAAI,CAAC,CAAA;AAClD;ACPO,SAAS,OAAA,CAAW,MAAuC,IAAA,EAAe;AAC/E,EAAAC,iBAAA,CAAU,IAAA,CAAK,MAAA,CAAO,IAAI,CAAC,CAAA;AAC7B","file":"index.js","sourcesContent":["import { render } from 'solid-js/web';\nimport type { JSX } from 'solid-js';\nimport { BaseComponent, EventBus } from '@panyam/tsappkit';\n\n/**\n * Mounts a Solid tree inside the tsappkit component lifecycle.\n *\n * The Solid root is created in `activate`, not the constructor, so the render\n * function can close over dependencies injected during `setupDependencies`\n * (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's\n * `onCleanup` handlers and removes the inserted nodes.\n *\n * The island owns all of its `rootElement`'s children while active, so give it\n * a dedicated element (an island page's `data-slot`). Whatever was there\n * before, such as the skeleton or `<noscript>` line Go rendered as the slot's\n * fallback, is removed on the first `activate`, in the same task that renders\n * the tree, so the slot never shows empty. Solid's `render` appends rather\n * than replacing, which is why this clears first. This class is the only place\n * framework (Solid) reactivity lives; tsappkit core and any presenter behind\n * it stay framework-neutral.\n */\nexport class SolidIsland extends BaseComponent {\n private disposeRoot?: () => void;\n\n constructor(\n componentId: string,\n rootElement: HTMLElement,\n private readonly renderRoot: () => JSX.Element,\n eventBus: EventBus | null = null,\n debugMode: boolean = false,\n ) {\n super(componentId, rootElement, eventBus, debugMode);\n }\n\n /**\n * Replace `rootElement`'s children with the Solid tree. Idempotent: calling\n * it again while already mounted is a no-op (the existing root is kept, not\n * cleared or remounted).\n */\n public activate(): void {\n if (this.disposeRoot) return;\n this.rootElement.replaceChildren();\n this.disposeRoot = render(this.renderRoot, this.rootElement);\n }\n\n /**\n * Dispose the Solid tree (runs `onCleanup`, removes the inserted nodes), then\n * defer to the base cleanup (clears the `data-component` marker).\n */\n public deactivate(): void {\n this.disposeRoot?.();\n this.disposeRoot = undefined;\n super.deactivate();\n }\n}\n","import { createSignal, type Accessor } from 'solid-js';\n\n/**\n * Create a Solid-backed cell for the \"typed view-interface method backed by a\n * signal\" pattern: the accessor drives JSX, the returned setter is the\n * command-down method a framework-agnostic presenter calls.\n *\n * The setter always writes via the updater form (`set(() => next)`) rather than\n * `set(next)`. Solid treats a function passed to a signal setter as an updater\n * to run, not a value to store, so a plain `set(next)` would be wrong whenever\n * `S` is itself a function type. Wrapping makes `signalView` a correct\n * \"replace the value\" setter for any `S`.\n */\nexport function signalView<S>(initial: S): [Accessor<S>, (next: S) => void] {\n const [value, setValue] = createSignal<S>(initial);\n return [value, (next: S) => setValue(() => next)];\n}\n","import { onCleanup } from 'solid-js';\n\n/**\n * Attaches `view` to a presenter's port for as long as the current Solid owner\n * lives. Called from a SolidIsland's render function, that's from the island's\n * activate to its deactivate, so a presenter never calls into an island that\n * has gone. The port is typed structurally so this works with tsappkit's Port\n * or anything with the same attach.\n */\nexport function useView<V>(port: { attach(view: V): () => void }, view: V): void {\n onCleanup(port.attach(view));\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { render } from 'solid-js/web';
2
2
  import { BaseComponent } from '@panyam/tsappkit';
3
- import { createSignal } from 'solid-js';
3
+ import { createSignal, onCleanup } from 'solid-js';
4
4
 
5
5
  // src/SolidIsland.ts
6
6
  var SolidIsland = class extends BaseComponent {
@@ -32,7 +32,10 @@ function signalView(initial) {
32
32
  const [value, setValue] = createSignal(initial);
33
33
  return [value, (next) => setValue(() => next)];
34
34
  }
35
+ function useView(port, view) {
36
+ onCleanup(port.attach(view));
37
+ }
35
38
 
36
- export { SolidIsland, signalView };
39
+ export { SolidIsland, signalView, useView };
37
40
  //# sourceMappingURL=index.mjs.map
38
41
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts"],"names":[],"mappings":";;;;;AAqBO,IAAM,WAAA,GAAN,cAA0B,aAAA,CAAc;AAAA,EAG7C,YACE,WAAA,EACA,WAAA,EACiB,YACjB,QAAA,GAA4B,IAAA,EAC5B,YAAqB,KAAA,EACrB;AACA,IAAA,KAAA,CAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAU,SAAS,CAAA;AAJlC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAKnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,GAAiB;AACtB,IAAA,IAAI,KAAK,WAAA,EAAa;AACtB,IAAA,IAAA,CAAK,YAAY,eAAA,EAAgB;AACjC,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,UAAA,EAAY,KAAK,WAAW,CAAA;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAA,GAAmB;AACxB,IAAA,IAAA,CAAK,WAAA,IAAc;AACnB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,IAAA,KAAA,CAAM,UAAA,EAAW;AAAA,EACnB;AACF;ACzCO,SAAS,WAAc,OAAA,EAA8C;AAC1E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,aAAgB,OAAO,CAAA;AACjD,EAAA,OAAO,CAAC,KAAA,EAAO,CAAC,SAAY,QAAA,CAAS,MAAM,IAAI,CAAC,CAAA;AAClD","file":"index.mjs","sourcesContent":["import { render } from 'solid-js/web';\nimport type { JSX } from 'solid-js';\nimport { BaseComponent, EventBus } from '@panyam/tsappkit';\n\n/**\n * Mounts a Solid tree inside the tsappkit component lifecycle.\n *\n * The Solid root is created in `activate`, not the constructor, so the render\n * function can close over dependencies injected during `setupDependencies`\n * (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's\n * `onCleanup` handlers and removes the inserted nodes.\n *\n * The island owns all of its `rootElement`'s children while active, so give it\n * a dedicated element (an island page's `data-slot`). Whatever was there\n * before, such as the skeleton or `<noscript>` line Go rendered as the slot's\n * fallback, is removed on the first `activate`, in the same task that renders\n * the tree, so the slot never shows empty. Solid's `render` appends rather\n * than replacing, which is why this clears first. This class is the only place\n * framework (Solid) reactivity lives; tsappkit core and any presenter behind\n * it stay framework-neutral.\n */\nexport class SolidIsland extends BaseComponent {\n private disposeRoot?: () => void;\n\n constructor(\n componentId: string,\n rootElement: HTMLElement,\n private readonly renderRoot: () => JSX.Element,\n eventBus: EventBus | null = null,\n debugMode: boolean = false,\n ) {\n super(componentId, rootElement, eventBus, debugMode);\n }\n\n /**\n * Replace `rootElement`'s children with the Solid tree. Idempotent: calling\n * it again while already mounted is a no-op (the existing root is kept, not\n * cleared or remounted).\n */\n public activate(): void {\n if (this.disposeRoot) return;\n this.rootElement.replaceChildren();\n this.disposeRoot = render(this.renderRoot, this.rootElement);\n }\n\n /**\n * Dispose the Solid tree (runs `onCleanup`, removes the inserted nodes), then\n * defer to the base cleanup (clears the `data-component` marker).\n */\n public deactivate(): void {\n this.disposeRoot?.();\n this.disposeRoot = undefined;\n super.deactivate();\n }\n}\n","import { createSignal, type Accessor } from 'solid-js';\n\n/**\n * Create a Solid-backed cell for the \"typed view-interface method backed by a\n * signal\" pattern: the accessor drives JSX, the returned setter is the\n * command-down method a framework-agnostic presenter calls.\n *\n * The setter always writes via the updater form (`set(() => next)`) rather than\n * `set(next)`. Solid treats a function passed to a signal setter as an updater\n * to run, not a value to store, so a plain `set(next)` would be wrong whenever\n * `S` is itself a function type. Wrapping makes `signalView` a correct\n * \"replace the value\" setter for any `S`.\n */\nexport function signalView<S>(initial: S): [Accessor<S>, (next: S) => void] {\n const [value, setValue] = createSignal<S>(initial);\n return [value, (next: S) => setValue(() => next)];\n}\n"]}
1
+ {"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts","../src/useView.ts"],"names":[],"mappings":";;;;;AAqBO,IAAM,WAAA,GAAN,cAA0B,aAAA,CAAc;AAAA,EAG7C,YACE,WAAA,EACA,WAAA,EACiB,YACjB,QAAA,GAA4B,IAAA,EAC5B,YAAqB,KAAA,EACrB;AACA,IAAA,KAAA,CAAM,WAAA,EAAa,WAAA,EAAa,QAAA,EAAU,SAAS,CAAA;AAJlC,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAKnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAA,GAAiB;AACtB,IAAA,IAAI,KAAK,WAAA,EAAa;AACtB,IAAA,IAAA,CAAK,YAAY,eAAA,EAAgB;AACjC,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA,CAAO,IAAA,CAAK,UAAA,EAAY,KAAK,WAAW,CAAA;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAA,GAAmB;AACxB,IAAA,IAAA,CAAK,WAAA,IAAc;AACnB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,IAAA,KAAA,CAAM,UAAA,EAAW;AAAA,EACnB;AACF;ACzCO,SAAS,WAAc,OAAA,EAA8C;AAC1E,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,aAAgB,OAAO,CAAA;AACjD,EAAA,OAAO,CAAC,KAAA,EAAO,CAAC,SAAY,QAAA,CAAS,MAAM,IAAI,CAAC,CAAA;AAClD;ACPO,SAAS,OAAA,CAAW,MAAuC,IAAA,EAAe;AAC/E,EAAA,SAAA,CAAU,IAAA,CAAK,MAAA,CAAO,IAAI,CAAC,CAAA;AAC7B","file":"index.mjs","sourcesContent":["import { render } from 'solid-js/web';\nimport type { JSX } from 'solid-js';\nimport { BaseComponent, EventBus } from '@panyam/tsappkit';\n\n/**\n * Mounts a Solid tree inside the tsappkit component lifecycle.\n *\n * The Solid root is created in `activate`, not the constructor, so the render\n * function can close over dependencies injected during `setupDependencies`\n * (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's\n * `onCleanup` handlers and removes the inserted nodes.\n *\n * The island owns all of its `rootElement`'s children while active, so give it\n * a dedicated element (an island page's `data-slot`). Whatever was there\n * before, such as the skeleton or `<noscript>` line Go rendered as the slot's\n * fallback, is removed on the first `activate`, in the same task that renders\n * the tree, so the slot never shows empty. Solid's `render` appends rather\n * than replacing, which is why this clears first. This class is the only place\n * framework (Solid) reactivity lives; tsappkit core and any presenter behind\n * it stay framework-neutral.\n */\nexport class SolidIsland extends BaseComponent {\n private disposeRoot?: () => void;\n\n constructor(\n componentId: string,\n rootElement: HTMLElement,\n private readonly renderRoot: () => JSX.Element,\n eventBus: EventBus | null = null,\n debugMode: boolean = false,\n ) {\n super(componentId, rootElement, eventBus, debugMode);\n }\n\n /**\n * Replace `rootElement`'s children with the Solid tree. Idempotent: calling\n * it again while already mounted is a no-op (the existing root is kept, not\n * cleared or remounted).\n */\n public activate(): void {\n if (this.disposeRoot) return;\n this.rootElement.replaceChildren();\n this.disposeRoot = render(this.renderRoot, this.rootElement);\n }\n\n /**\n * Dispose the Solid tree (runs `onCleanup`, removes the inserted nodes), then\n * defer to the base cleanup (clears the `data-component` marker).\n */\n public deactivate(): void {\n this.disposeRoot?.();\n this.disposeRoot = undefined;\n super.deactivate();\n }\n}\n","import { createSignal, type Accessor } from 'solid-js';\n\n/**\n * Create a Solid-backed cell for the \"typed view-interface method backed by a\n * signal\" pattern: the accessor drives JSX, the returned setter is the\n * command-down method a framework-agnostic presenter calls.\n *\n * The setter always writes via the updater form (`set(() => next)`) rather than\n * `set(next)`. Solid treats a function passed to a signal setter as an updater\n * to run, not a value to store, so a plain `set(next)` would be wrong whenever\n * `S` is itself a function type. Wrapping makes `signalView` a correct\n * \"replace the value\" setter for any `S`.\n */\nexport function signalView<S>(initial: S): [Accessor<S>, (next: S) => void] {\n const [value, setValue] = createSignal<S>(initial);\n return [value, (next: S) => setValue(() => next)];\n}\n","import { onCleanup } from 'solid-js';\n\n/**\n * Attaches `view` to a presenter's port for as long as the current Solid owner\n * lives. Called from a SolidIsland's render function, that's from the island's\n * activate to its deactivate, so a presenter never calls into an island that\n * has gone. The port is typed structurally so this works with tsappkit's Port\n * or anything with the same attach.\n */\nexport function useView<V>(port: { attach(view: V): () => void }, view: V): void {\n onCleanup(port.attach(view));\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panyam/tsappkit-solid",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Solid adapter for @panyam/tsappkit: mount Solid islands inside the tsappkit component lifecycle. The framework-specific reactivity lives here so tsappkit core stays framework-neutral.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -46,7 +46,7 @@
46
46
  "@solidjs/testing-library": "^0.8.10",
47
47
  "esbuild-plugin-solid": "^0.6.0",
48
48
  "jsdom": "^29.1.1",
49
- "solid-js": "^1.9.14",
49
+ "solid-js": "^1.9.17",
50
50
  "tsup": "^8.5.1",
51
51
  "typescript": "^5.9.3",
52
52
  "vite-plugin-solid": "^2.11.12",
package/src/index.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  //
3
3
  // Framework reactivity lives here so tsappkit core stays framework-neutral:
4
4
  // SolidIsland bridges a Solid root into the tsappkit component lifecycle, and
5
- // signalView backs a typed view-interface method with a Solid signal.
5
+ // signalView backs a typed view-interface method with a Solid signal, and
6
+ // useView attaches a view to a presenter's Port while the island is active.
6
7
  export { SolidIsland } from './SolidIsland';
7
8
  export { signalView } from './signalView';
9
+ export { useView } from './useView';
package/src/useView.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { onCleanup } from 'solid-js';
2
+
3
+ /**
4
+ * Attaches `view` to a presenter's port for as long as the current Solid owner
5
+ * lives. Called from a SolidIsland's render function, that's from the island's
6
+ * activate to its deactivate, so a presenter never calls into an island that
7
+ * has gone. The port is typed structurally so this works with tsappkit's Port
8
+ * or anything with the same attach.
9
+ */
10
+ export function useView<V>(port: { attach(view: V): () => void }, view: V): void {
11
+ onCleanup(port.attach(view));
12
+ }