@panyam/tsappkit-solid 0.6.0 → 0.6.1
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 +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SolidIsland.ts +12 -5
package/dist/index.d.mts
CHANGED
|
@@ -9,17 +9,23 @@ import { BaseComponent, EventBus } from '@panyam/tsappkit';
|
|
|
9
9
|
* (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's
|
|
10
10
|
* `onCleanup` handlers and removes the inserted nodes.
|
|
11
11
|
*
|
|
12
|
-
* The island owns its `rootElement`'s children while active, so give it
|
|
13
|
-
* dedicated element
|
|
14
|
-
*
|
|
12
|
+
* The island owns all of its `rootElement`'s children while active, so give it
|
|
13
|
+
* a dedicated element (an island page's `data-slot`). Whatever was there
|
|
14
|
+
* before, such as the skeleton or `<noscript>` line Go rendered as the slot's
|
|
15
|
+
* fallback, is removed on the first `activate`, in the same task that renders
|
|
16
|
+
* the tree, so the slot never shows empty. Solid's `render` appends rather
|
|
17
|
+
* than replacing, which is why this clears first. This class is the only place
|
|
18
|
+
* framework (Solid) reactivity lives; tsappkit core and any presenter behind
|
|
19
|
+
* it stay framework-neutral.
|
|
15
20
|
*/
|
|
16
21
|
declare class SolidIsland extends BaseComponent {
|
|
17
22
|
private readonly renderRoot;
|
|
18
23
|
private disposeRoot?;
|
|
19
24
|
constructor(componentId: string, rootElement: HTMLElement, renderRoot: () => JSX.Element, eventBus?: EventBus | null, debugMode?: boolean);
|
|
20
25
|
/**
|
|
21
|
-
*
|
|
22
|
-
* already mounted is a no-op (the existing root is kept, not
|
|
26
|
+
* Replace `rootElement`'s children with the Solid tree. Idempotent: calling
|
|
27
|
+
* it again while already mounted is a no-op (the existing root is kept, not
|
|
28
|
+
* cleared or remounted).
|
|
23
29
|
*/
|
|
24
30
|
activate(): void;
|
|
25
31
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -9,17 +9,23 @@ import { BaseComponent, EventBus } from '@panyam/tsappkit';
|
|
|
9
9
|
* (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's
|
|
10
10
|
* `onCleanup` handlers and removes the inserted nodes.
|
|
11
11
|
*
|
|
12
|
-
* The island owns its `rootElement`'s children while active, so give it
|
|
13
|
-
* dedicated element
|
|
14
|
-
*
|
|
12
|
+
* The island owns all of its `rootElement`'s children while active, so give it
|
|
13
|
+
* a dedicated element (an island page's `data-slot`). Whatever was there
|
|
14
|
+
* before, such as the skeleton or `<noscript>` line Go rendered as the slot's
|
|
15
|
+
* fallback, is removed on the first `activate`, in the same task that renders
|
|
16
|
+
* the tree, so the slot never shows empty. Solid's `render` appends rather
|
|
17
|
+
* than replacing, which is why this clears first. This class is the only place
|
|
18
|
+
* framework (Solid) reactivity lives; tsappkit core and any presenter behind
|
|
19
|
+
* it stay framework-neutral.
|
|
15
20
|
*/
|
|
16
21
|
declare class SolidIsland extends BaseComponent {
|
|
17
22
|
private readonly renderRoot;
|
|
18
23
|
private disposeRoot?;
|
|
19
24
|
constructor(componentId: string, rootElement: HTMLElement, renderRoot: () => JSX.Element, eventBus?: EventBus | null, debugMode?: boolean);
|
|
20
25
|
/**
|
|
21
|
-
*
|
|
22
|
-
* already mounted is a no-op (the existing root is kept, not
|
|
26
|
+
* Replace `rootElement`'s children with the Solid tree. Idempotent: calling
|
|
27
|
+
* it again while already mounted is a no-op (the existing root is kept, not
|
|
28
|
+
* cleared or remounted).
|
|
23
29
|
*/
|
|
24
30
|
activate(): void;
|
|
25
31
|
/**
|
package/dist/index.js
CHANGED
|
@@ -11,11 +11,13 @@ var SolidIsland = class extends tsappkit.BaseComponent {
|
|
|
11
11
|
this.renderRoot = renderRoot;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* already mounted is a no-op (the existing root is kept, not
|
|
14
|
+
* Replace `rootElement`'s children with the Solid tree. Idempotent: calling
|
|
15
|
+
* it again while already mounted is a no-op (the existing root is kept, not
|
|
16
|
+
* cleared or remounted).
|
|
16
17
|
*/
|
|
17
18
|
activate() {
|
|
18
19
|
if (this.disposeRoot) return;
|
|
20
|
+
this.rootElement.replaceChildren();
|
|
19
21
|
this.disposeRoot = web.render(this.renderRoot, this.rootElement);
|
|
20
22
|
}
|
|
21
23
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts"],"names":["BaseComponent","render","createSignal"],"mappings":";;;;;;;
|
|
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"]}
|
package/dist/index.mjs
CHANGED
|
@@ -9,11 +9,13 @@ var SolidIsland = class extends BaseComponent {
|
|
|
9
9
|
this.renderRoot = renderRoot;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* already mounted is a no-op (the existing root is kept, not
|
|
12
|
+
* Replace `rootElement`'s children with the Solid tree. Idempotent: calling
|
|
13
|
+
* it again while already mounted is a no-op (the existing root is kept, not
|
|
14
|
+
* cleared or remounted).
|
|
14
15
|
*/
|
|
15
16
|
activate() {
|
|
16
17
|
if (this.disposeRoot) return;
|
|
18
|
+
this.rootElement.replaceChildren();
|
|
17
19
|
this.disposeRoot = render(this.renderRoot, this.rootElement);
|
|
18
20
|
}
|
|
19
21
|
/**
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SolidIsland.ts","../src/signalView.ts"],"names":[],"mappings":";;;;;
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panyam/tsappkit-solid",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
package/src/SolidIsland.ts
CHANGED
|
@@ -10,9 +10,14 @@ import { BaseComponent, EventBus } from '@panyam/tsappkit';
|
|
|
10
10
|
* (e.g. a presenter). It is disposed in `deactivate`, which runs Solid's
|
|
11
11
|
* `onCleanup` handlers and removes the inserted nodes.
|
|
12
12
|
*
|
|
13
|
-
* The island owns its `rootElement`'s children while active, so give it
|
|
14
|
-
* dedicated element
|
|
15
|
-
*
|
|
13
|
+
* The island owns all of its `rootElement`'s children while active, so give it
|
|
14
|
+
* a dedicated element (an island page's `data-slot`). Whatever was there
|
|
15
|
+
* before, such as the skeleton or `<noscript>` line Go rendered as the slot's
|
|
16
|
+
* fallback, is removed on the first `activate`, in the same task that renders
|
|
17
|
+
* the tree, so the slot never shows empty. Solid's `render` appends rather
|
|
18
|
+
* than replacing, which is why this clears first. This class is the only place
|
|
19
|
+
* framework (Solid) reactivity lives; tsappkit core and any presenter behind
|
|
20
|
+
* it stay framework-neutral.
|
|
16
21
|
*/
|
|
17
22
|
export class SolidIsland extends BaseComponent {
|
|
18
23
|
private disposeRoot?: () => void;
|
|
@@ -28,11 +33,13 @@ export class SolidIsland extends BaseComponent {
|
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
32
|
-
* already mounted is a no-op (the existing root is kept, not
|
|
36
|
+
* Replace `rootElement`'s children with the Solid tree. Idempotent: calling
|
|
37
|
+
* it again while already mounted is a no-op (the existing root is kept, not
|
|
38
|
+
* cleared or remounted).
|
|
33
39
|
*/
|
|
34
40
|
public activate(): void {
|
|
35
41
|
if (this.disposeRoot) return;
|
|
42
|
+
this.rootElement.replaceChildren();
|
|
36
43
|
this.disposeRoot = render(this.renderRoot, this.rootElement);
|
|
37
44
|
}
|
|
38
45
|
|