@subnoto/embed-svelte 0.555.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/index.ts +1 -0
- package/package.json +36 -0
- package/src/SignEmbed.svelte +67 -0
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SignEmbed } from "./src/SignEmbed.svelte";
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@subnoto/embed-svelte",
|
|
3
|
+
"version": "0.555.1",
|
|
4
|
+
"description": "Subnoto embed – svelte components",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/nickel-org/subnoto-monorepo-public.git",
|
|
9
|
+
"directory": "libs/embeds/output/svelte"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"subnoto",
|
|
13
|
+
"embeds",
|
|
14
|
+
"svelte"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"files": [
|
|
19
|
+
"src/",
|
|
20
|
+
"index.ts",
|
|
21
|
+
"index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"main": "index.ts",
|
|
24
|
+
"module": "index.ts",
|
|
25
|
+
"types": "index.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./index.ts",
|
|
29
|
+
"import": "./index.ts",
|
|
30
|
+
"default": "./index.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"svelte": ">=3.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
// Copyright 2025 Subnoto
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
|
|
16
|
+
export type SignEmbedProps = {
|
|
17
|
+
/** Pre-built iframe URL. If set, host and token are ignored. */
|
|
18
|
+
iframeUrl?: string;
|
|
19
|
+
/** Base URL of the Subnoto app (e.g. https://app.subnoto.com). Used when token is set. */
|
|
20
|
+
host?: string;
|
|
21
|
+
/** Iframe token (from e.g. authentication_create-iframe-token). Passed in URL hash as #t=... */
|
|
22
|
+
token?: string;
|
|
23
|
+
/** Optional CSS class for the iframe. */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Iframe title for accessibility. */
|
|
26
|
+
title?: string;
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
const DEFAULT_HOST = "https://app.subnoto.com";
|
|
32
|
+
|
|
33
|
+
export let iframeUrl: SignEmbedProps["iframeUrl"];
|
|
34
|
+
export let host: SignEmbedProps["host"];
|
|
35
|
+
export let token: SignEmbedProps["token"];
|
|
36
|
+
export let title: SignEmbedProps["title"];
|
|
37
|
+
export let className: SignEmbedProps["className"];
|
|
38
|
+
function stringifyStyles(stylesObj) {
|
|
39
|
+
let styles = "";
|
|
40
|
+
for (let key in stylesObj) {
|
|
41
|
+
const dashedKey = key.replace(/[A-Z]/g, function (match) {
|
|
42
|
+
return "-" + match.toLowerCase();
|
|
43
|
+
});
|
|
44
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
45
|
+
}
|
|
46
|
+
return styles;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
$: src = () => {
|
|
50
|
+
if (iframeUrl) return iframeUrl;
|
|
51
|
+
const base = (host || DEFAULT_HOST).replace(/\/$/, "");
|
|
52
|
+
const token = token ?? "";
|
|
53
|
+
return `${base}/embeds/sign#t=${encodeURIComponent(token)}`;
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<iframe
|
|
58
|
+
style={stringifyStyles({
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "100%",
|
|
61
|
+
border: 0,
|
|
62
|
+
})}
|
|
63
|
+
allow="fullscreen"
|
|
64
|
+
src={src()}
|
|
65
|
+
title={title ?? "Subnoto signing"}
|
|
66
|
+
class={className}
|
|
67
|
+
/>
|