@uniformdev/canvas-sveltekit 20.48.1-alpha.17 → 20.48.1-alpha.19
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 {
|
|
1
|
+
export { UniformRichText, UniformRichTextNode } from '@uniformdev/canvas-svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
// Re-export UniformRichText from canvas-svelte for convenience
|
|
2
|
+
export { UniformRichText, UniformRichTextNode } from '@uniformdev/canvas-svelte';
|
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.
|
|
3
|
+
"version": "20.48.1-alpha.19+4e297b987c",
|
|
4
4
|
"description": "SvelteKit SDK for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"scripts": {
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"svelte": "^5.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@uniformdev/canvas": "20.48.1-alpha.
|
|
46
|
-
"@uniformdev/canvas-svelte": "20.48.1-alpha.
|
|
47
|
-
"@uniformdev/context": "20.48.1-alpha.
|
|
48
|
-
"@uniformdev/project-map": "20.48.1-alpha.
|
|
49
|
-
"@uniformdev/redirect": "20.48.1-alpha.
|
|
50
|
-
"@uniformdev/richtext": "20.48.1-alpha.
|
|
45
|
+
"@uniformdev/canvas": "20.48.1-alpha.19+4e297b987c",
|
|
46
|
+
"@uniformdev/canvas-svelte": "20.48.1-alpha.19+4e297b987c",
|
|
47
|
+
"@uniformdev/context": "20.48.1-alpha.19+4e297b987c",
|
|
48
|
+
"@uniformdev/project-map": "20.48.1-alpha.19+4e297b987c",
|
|
49
|
+
"@uniformdev/redirect": "20.48.1-alpha.19+4e297b987c",
|
|
50
|
+
"@uniformdev/richtext": "20.48.1-alpha.19+4e297b987c",
|
|
51
51
|
"colorette": "2.0.20"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "4e297b987c1add85bb5d395103ee26557fa66d4f"
|
|
75
75
|
}
|
|
@@ -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;
|