@uniformdev/canvas-sveltekit 20.48.1-alpha.17 → 20.48.1-alpha.22

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.
@@ -1 +1 @@
1
- export { default as UniformRichText } from './UniformRichText.svelte';
1
+ export { UniformRichText, UniformRichTextNode } from '@uniformdev/canvas-svelte';
@@ -1 +1,2 @@
1
- export { default as UniformRichText } from './UniformRichText.svelte';
1
+ // Re-export UniformRichText from canvas-svelte for convenience
2
+ export { UniformRichText, UniformRichTextNode } from '@uniformdev/canvas-svelte';
@@ -0,0 +1,5 @@
1
+ import { Context } from '@uniformdev/context';
2
+ export declare const createUniformNesiResponseHandler: () => ({ response, context, }: {
3
+ response: Response;
4
+ context: Context;
5
+ }) => Promise<Response>;
@@ -0,0 +1,39 @@
1
+ import { Context } from '@uniformdev/context';
2
+ import { transformEdgeStream } from '@uniformdev/context-edge';
3
+ export const createUniformNesiResponseHandler = () => {
4
+ return async ({ response, context, }) => {
5
+ const { readable, writable } = new TransformStream();
6
+ const processedResponse = new Response(readable, response);
7
+ if (processedResponse.headers.has('content-length')) {
8
+ processedResponse.headers.delete('content-length');
9
+ }
10
+ const reader = response?.body?.getReader();
11
+ if (!reader) {
12
+ return processedResponse;
13
+ }
14
+ const writer = writable.getWriter();
15
+ transformEdgeStream({
16
+ context,
17
+ decoder: new TextDecoder(),
18
+ encoder: new TextEncoder(),
19
+ reader: {
20
+ read: async () => {
21
+ const { done, value } = await reader.read();
22
+ return {
23
+ done,
24
+ value,
25
+ };
26
+ },
27
+ },
28
+ writer: {
29
+ write: (value) => {
30
+ writer.write(value);
31
+ },
32
+ close: () => {
33
+ return writer.close();
34
+ },
35
+ },
36
+ });
37
+ return processedResponse;
38
+ };
39
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { type ResolveFullPath, type ResolveFullPathOptions, type RouteCompositionResult, UNIFORM_PREVIEW_COOKIE_NAME, type UniformPageData, type UniformPreviewData, } from './models.js';
2
- export { UniformRichText } from './components/index.js';
2
+ export { UniformRichText, UniformRichTextNode } from './components/index.js';
3
3
  export { resolvePathFromParams } from './helpers/index.js';
4
4
  export { type CompositionIssue, logCompositionIssues, logCompositionResponse, logCompositionRouteResponse, logNotFoundRouteResponse, logRedirectRouteResponse, logRouteResponse, } from './logging/index.js';
5
5
  export { createUniformHandle, type CreateUniformHandleOptions } from './hooks/index.js';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Models and types
2
2
  export { UNIFORM_PREVIEW_COOKIE_NAME, } from './models.js';
3
- // Components
4
- export { UniformRichText } from './components/index.js';
3
+ // Components (re-exported from canvas-svelte for convenience)
4
+ export { UniformRichText, UniformRichTextNode } from './components/index.js';
5
5
  // Helpers
6
6
  export { resolvePathFromParams } from './helpers/index.js';
7
7
  // Logging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-sveltekit",
3
- "version": "20.48.1-alpha.17+0e73d5d0a0",
3
+ "version": "20.48.1-alpha.22+be44ac21f7",
4
4
  "description": "SvelteKit SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "scripts": {
@@ -35,19 +35,29 @@
35
35
  "./preview": {
36
36
  "types": "./dist/preview/index.d.ts",
37
37
  "svelte": "./dist/preview/index.js"
38
+ },
39
+ "./edge": {
40
+ "types": "./dist/edge/index.d.ts",
41
+ "svelte": "./dist/edge/index.js"
38
42
  }
39
43
  },
40
44
  "peerDependencies": {
41
45
  "@sveltejs/kit": "^2.0.0",
46
+ "@uniformdev/context-edge": "workspace:*",
42
47
  "svelte": "^5.0.0"
43
48
  },
49
+ "peerDependenciesMeta": {
50
+ "@uniformdev/context-edge": {
51
+ "optional": true
52
+ }
53
+ },
44
54
  "dependencies": {
45
- "@uniformdev/canvas": "20.48.1-alpha.17+0e73d5d0a0",
46
- "@uniformdev/canvas-svelte": "20.48.1-alpha.17+0e73d5d0a0",
47
- "@uniformdev/context": "20.48.1-alpha.17+0e73d5d0a0",
48
- "@uniformdev/project-map": "20.48.1-alpha.17+0e73d5d0a0",
49
- "@uniformdev/redirect": "20.48.1-alpha.17+0e73d5d0a0",
50
- "@uniformdev/richtext": "20.48.1-alpha.17+0e73d5d0a0",
55
+ "@uniformdev/canvas": "20.48.1-alpha.22+be44ac21f7",
56
+ "@uniformdev/canvas-svelte": "20.48.1-alpha.22+be44ac21f7",
57
+ "@uniformdev/context": "20.48.1-alpha.22+be44ac21f7",
58
+ "@uniformdev/project-map": "20.48.1-alpha.22+be44ac21f7",
59
+ "@uniformdev/redirect": "20.48.1-alpha.22+be44ac21f7",
60
+ "@uniformdev/richtext": "20.48.1-alpha.22+be44ac21f7",
51
61
  "colorette": "2.0.20"
52
62
  },
53
63
  "devDependencies": {
@@ -56,6 +66,7 @@
56
66
  "@sveltejs/kit": "^2.49.1",
57
67
  "@sveltejs/package": "^2.5.7",
58
68
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
69
+ "@uniformdev/context-edge": "20.48.1-alpha.22+be44ac21f7",
59
70
  "publint": "^0.3.15",
60
71
  "svelte": "^5.45.6",
61
72
  "svelte-check": "^4.3.4",
@@ -71,5 +82,5 @@
71
82
  "publishConfig": {
72
83
  "access": "public"
73
84
  },
74
- "gitHead": "0e73d5d0a0289425228453d1107da1fa198d5d3a"
85
+ "gitHead": "be44ac21f739102a601c27185827c2bc75f14fe1"
75
86
  }
@@ -1,49 +0,0 @@
1
- <script lang="ts">
2
- import type { ComponentInstance } from '@uniformdev/canvas';
3
- import type { ParameterRichTextValue } from '@uniformdev/richtext';
4
-
5
- interface Props {
6
- /** The ID of the parameter containing rich text */
7
- parameterId: string;
8
- /** The component instance containing the parameter */
9
- component: ComponentInstance;
10
- /** Custom render function for the rich text */
11
- render?: (value: string | undefined) => string;
12
- /** HTML element to wrap the content */
13
- as?: string;
14
- /** Additional HTML attributes */
15
- [key: string]: any;
16
- }
17
-
18
- let { parameterId, component, render, as: Tag = 'div', ...props }: Props = $props();
19
-
20
- /**
21
- * Extracts HTML from rich text parameter value.
22
- * Handles both simple string values and structured rich text objects.
23
- */
24
- function getHtmlValue(value: ParameterRichTextValue | string | undefined): string | undefined {
25
- if (!value) {
26
- return undefined;
27
- }
28
-
29
- if (typeof value === 'string') {
30
- return value;
31
- }
32
-
33
- // Handle structured rich text value (Lexical serialized state)
34
- // For now, return undefined as rich text needs to be rendered
35
- return undefined;
36
- }
37
-
38
- // Use $derived for reactive values
39
- const parameter = $derived(component?.parameters?.[parameterId]);
40
- const rawValue = $derived(parameter?.value as ParameterRichTextValue | string | undefined);
41
- const htmlValue = $derived(getHtmlValue(rawValue));
42
- const finalValue = $derived(render ? render(htmlValue) : htmlValue);
43
- </script>
44
-
45
- {#if finalValue}
46
- <svelte:element this={Tag} {...props}>
47
- {@html finalValue}
48
- </svelte:element>
49
- {/if}
@@ -1,16 +0,0 @@
1
- import type { ComponentInstance } from '@uniformdev/canvas';
2
- interface Props {
3
- /** The ID of the parameter containing rich text */
4
- parameterId: string;
5
- /** The component instance containing the parameter */
6
- component: ComponentInstance;
7
- /** Custom render function for the rich text */
8
- render?: (value: string | undefined) => string;
9
- /** HTML element to wrap the content */
10
- as?: string;
11
- /** Additional HTML attributes */
12
- [key: string]: any;
13
- }
14
- declare const UniformRichText: import("svelte").Component<Props, {}, "">;
15
- type UniformRichText = ReturnType<typeof UniformRichText>;
16
- export default UniformRichText;