@pixerate/editor-svelte 0.174.1 → 0.175.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.
package/dist/index.d.ts CHANGED
@@ -50,4 +50,5 @@ export * from "./generation/index.js";
50
50
  export * from "./find-replace/index.js";
51
51
  export * from "./tables/index.js";
52
52
  export * from "./chart-node/index.js";
53
+ export * from "./loading-node/index.js";
53
54
  export * from "./style/index.js";
package/dist/index.js CHANGED
@@ -30,4 +30,5 @@ export * from "./generation/index.js";
30
30
  export * from "./find-replace/index.js";
31
31
  export * from "./tables/index.js";
32
32
  export * from "./chart-node/index.js";
33
+ export * from "./loading-node/index.js";
33
34
  export * from "./style/index.js";
@@ -0,0 +1,11 @@
1
+ import { type Component } from "svelte";
2
+ import type { LoadingNodeViewMount, LoadingNodeViewState } from "@pixerate/editor";
3
+ /**
4
+ * The `nodeView` for the core `loadingNode`, mounting `component` inside each placeholder:
5
+ * `LoadingNode.configure({ nodeView: createSvelteLoadingNodeView(MyLoader) })`. The component
6
+ * receives `view` (`LoadingNodeViewState`). The placeholder keeps `role="status"` and its
7
+ * `aria-label`, so the component can be decorative.
8
+ */
9
+ export declare function createSvelteLoadingNodeView(component: Component<{
10
+ view: LoadingNodeViewState;
11
+ }>): LoadingNodeViewMount;
@@ -0,0 +1,26 @@
1
+ import { mount, unmount } from "svelte";
2
+ /**
3
+ * The `nodeView` for the core `loadingNode`, mounting `component` inside each placeholder:
4
+ * `LoadingNode.configure({ nodeView: createSvelteLoadingNodeView(MyLoader) })`. The component
5
+ * receives `view` (`LoadingNodeViewState`). The placeholder keeps `role="status"` and its
6
+ * `aria-label`, so the component can be decorative.
7
+ */
8
+ export function createSvelteLoadingNodeView(component) {
9
+ return (dom, state) => {
10
+ let current = $state.raw(state);
11
+ const instance = mount(component, {
12
+ target: dom,
13
+ props: {
14
+ get view() {
15
+ return current;
16
+ },
17
+ },
18
+ });
19
+ return {
20
+ update: (next) => {
21
+ current = next;
22
+ },
23
+ destroy: () => void unmount(instance),
24
+ };
25
+ };
26
+ }
@@ -0,0 +1 @@
1
+ export * from "./createLoadingNodeView.svelte.js";
@@ -0,0 +1 @@
1
+ export * from "./createLoadingNodeView.svelte.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.174.1",
3
+ "version": "0.175.0",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -165,7 +165,7 @@
165
165
  "**/*.css"
166
166
  ],
167
167
  "dependencies": {
168
- "@pixerate/editor": "0.236.0"
168
+ "@pixerate/editor": "0.237.0"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@dagrejs/dagre": "^1.1.4",