@signosoft/signpad-js 0.2.0 → 0.2.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/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  ## 📍 Table of Contents
4
4
 
5
- | Core Concepts & Overview | Getting Started & Usage | Advanced & Support |
6
- | :---------------------------------------- | :--------------------------------- | :---------------------------- |
7
- | 📜 [Description](#-description) | 📦 [Installation](#-installation) | 🤝 [Feedback](#-feedback--support)|
8
- | 🎬 [Demo](#-demo) | 🔐 [Licensing](#-get-your-license) | 📄 [License](#-license) |
9
- | ⚙️ [Tech stack](#-tech-stack--built-with) | 🚀 [Quick Start](#-quick-start) | |
10
- | | 📋 [Properties](#-properties) | |
11
- | | 🧩 [Methods](#-methods) | |
12
- | | 🎨 [Styling](#-styling--theming) | |
5
+ | Core Concepts & Overview | Getting Started & Usage | Advanced & Support |
6
+ | :---------------------------------------- | :--------------------------------- | :--------------------------------- |
7
+ | 📜 [Description](#-description) | 📦 [Installation](#-installation) | 🤝 [Feedback](#-feedback--support) |
8
+ | 🎬 [Demo](#-demo) | 🔐 [Licensing](#-get-your-license) | 📄 [License](#-license) |
9
+ | ⚙️ [Tech stack](#-tech-stack--built-with) | 🚀 [Quick Start](#-quick-start) | |
10
+ | | 📋 [Properties](#-properties) | |
11
+ | | 🧩 [Methods](#-methods) | |
12
+ | | 🎨 [Styling](#-styling--theming) | |
13
13
 
14
14
  ## 📜 Description
15
15
 
@@ -29,7 +29,7 @@ It expertly handles the complexities of **WebHID device connections**, signature
29
29
 
30
30
  ## 🎬 Demo
31
31
 
32
- <img src="./docsVideo.gif" alt="Signosoft Demo" width="500" />
32
+ <img src="https://unpkg.com/@signosoft/signpad-js@latest/docsVideo.gif" alt="Signosoft Demo" width="500" />
33
33
 
34
34
  ## ⚙️ Tech Stack / Built With
35
35
 
@@ -104,15 +104,312 @@ First, install the core package:
104
104
  npm install your-library-name
105
105
  ```
106
106
 
107
- ### Framework Integration Guide
107
+ ### 🧰 Framework Integration Guide
108
108
 
109
- Choose your framework to see the full setup guide:
110
- | Framework | Setup Guide | Status |
111
- | :--- | :--- | :--- |
112
- | <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/angularjs/angularjs-original.svg" alt="Angular" width="15" height="15"> **Angular** | [Docs →](./framework-docs/integration-angular.md) | <font color="green">**Live**</font> |
113
- | <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" alt="React" width="15" height="15"> **React** | [Docs →](./framework-docs/integration-react.md) | <font color="green">**Live**</font> |
114
- | <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/vuejs/vuejs-original.svg" alt="Vue" width="15" height="15"> **Vue.js** | [Docs →](./framework-docs/integration-vue.md) | <font color="green">**Live**</font> |
115
- | <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/javascript/javascript-original.svg" alt="JS" width="15" height="15"> **Vanilla JS** | [Docs →](./framework-docs/integration-vanilla.md) | <font color="green">**Live**</font> |
109
+ <details>
110
+ <summary>
111
+ <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/angularjs/angularjs-original.svg" alt="Angular" width="15" height="15">
112
+ <b>Angular</b> <font color="green"><b>(Live)</b></font>
113
+ </summary>
114
+ <br>
115
+
116
+ # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/angular/angular-original.svg" alt="Angular" width="30" height="30"> Angular Integration Guide
117
+
118
+ This guide describes how to integrate the `@signosoft/signpad-js` web component into an Angular application.
119
+
120
+ ## 1. Installation
121
+
122
+ Install the core package using npm:
123
+
124
+ ```bash
125
+ npm install @signosoft/signpad-js
126
+ ```
127
+
128
+ ## 2. Create the Bridge Directive
129
+
130
+ Since `signosoft-signpad` is a Web Component, Angular requires a Directive to properly sync configuration changes and provide typed access to the component instance.
131
+
132
+ Create `signosoft-signpad.directive.ts`:
133
+
134
+ ```typescript
135
+ import {
136
+ Directive,
137
+ ElementRef,
138
+ Input,
139
+ OnChanges,
140
+ SimpleChanges,
141
+ } from "@angular/core";
142
+ import type { SignosoftSignpad, SignpadConfig } from "@signosoft/signpad-js";
143
+
144
+ @Directive({
145
+ selector: "signosoft-signpad",
146
+ standalone: true,
147
+ })
148
+ export class SignosoftSignpadDirective implements OnChanges {
149
+ @Input() config?: SignpadConfig;
150
+
151
+ constructor(private host: ElementRef<SignosoftSignpad>) {}
152
+
153
+ // Access the native Web Component instance
154
+ get signpadRef(): SignosoftSignpad {
155
+ return this.host.nativeElement;
156
+ }
157
+
158
+ ngOnChanges(changes: SimpleChanges) {
159
+ const el = this.host.nativeElement as any;
160
+ for (const key of Object.keys(changes)) {
161
+ el[key] = (this as any)[key];
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ ## 3. Implementation in Component
168
+
169
+ Import the library, the directive, and add the **`CUSTOM_ELEMENTS_SCHEMA`**.
170
+
171
+ ```typescript
172
+ import { Component, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
173
+ import "@signosoft/signpad-js"; // Import the Web Component registration
174
+ import {
175
+ type SignosoftSignpad,
176
+ type SignpadConfig,
177
+ } from "@signosoft/signpad-js";
178
+ import { SignosoftSignpadDirective } from "./directives/signosoft-signpad.directive";
179
+
180
+ @Component({
181
+ selector: "app-root",
182
+ standalone: true,
183
+ imports: [SignosoftSignpadDirective],
184
+ templateUrl: "./app.component.html",
185
+ schemas: [CUSTOM_ELEMENTS_SCHEMA], // Mandatory for custom HTML tags
186
+ })
187
+ export class AppComponent {
188
+ @ViewChild(SignosoftSignpadDirective)
189
+ signpadDirective!: SignosoftSignpadDirective;
190
+
191
+ config: SignpadConfig = {
192
+ licenseKey: "YOUR-LICENSE-KEY",
193
+ // More info in "properties" section
194
+ };
195
+
196
+ // Helper to access methods easily (ok, clear, cancel, etc.)
197
+ public get signpad(): SignosoftSignpad | undefined {
198
+ return this.signpadDirective?.signpadRef;
199
+ }
200
+ }
201
+ ```
202
+
203
+ ## 4. Component Template
204
+
205
+ Use the custom tag in your HTML and bind the configuration object.
206
+
207
+ ```html
208
+ <div>
209
+ <div>
210
+ <signosoft-signpad [config]="config"></signosoft-signpad>
211
+ </div>
212
+ </div>
213
+ ```
214
+
215
+ </details>
216
+
217
+ <details>
218
+ <summary>
219
+ <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" alt="React" width="15" height="15">
220
+ <b>React</b> <font color="green"><b>(Live)</b></font>
221
+ </summary>
222
+ <br>
223
+
224
+ # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" alt="React" width="30" height="30"> React - Quick start
225
+
226
+ This guide describes how to integrate the `@signosoft/signpad-js` web component into a React application (Functional Components with Hooks).
227
+
228
+ ## 1. Installation
229
+
230
+ Install the core package using npm:
231
+
232
+ ```bash
233
+ npm install @signosoft/signpad-js
234
+ ```
235
+
236
+ ## 2. Implementation
237
+
238
+ In React, we use the `useRef` hook to interact with the component's methods (like `ok()` or `clear()`) and pass the configuration directly via props.
239
+
240
+ ```tsx
241
+ import { useRef } from "react";
242
+ import "@signosoft/signpad-js"; // Registers the web component
243
+ import type { SignpadConfig } from "@signosoft/signpad-js";
244
+
245
+ function App() {
246
+ // Use ref to access component methods (ok, clear, connect, etc. by signpadRef.current)
247
+ const signpadRef = useRef<any>(null);
248
+
249
+ const config: SignpadConfig = {
250
+ licenseKey: "YOUR-LICENSE-KEY",
251
+ // More info in "properties" section
252
+ };
253
+
254
+ return (
255
+ <div>
256
+ <h1>Signosoft Signpad React Example</h1>
257
+ <signosoft-signpad ref={signpadRef} config={config} />
258
+ </div>
259
+ );
260
+ }
261
+
262
+ export default App;
263
+ ```
264
+
265
+ </details>
266
+
267
+ <details>
268
+ <summary>
269
+ <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/vuejs/vuejs-original.svg" alt="Vue" width="15" height="15">
270
+ <b>Vue.js</b> <font color="green"><b>(Live)</b></font>
271
+ </summary>
272
+ <br>
273
+
274
+ # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/vuejs/vuejs-original.svg" alt="Vue" width="30" height="30"> Vue.js Integration Guide
275
+
276
+ This guide describes how to integrate the `@signosoft/signpad-js` web component into a Vue 3 application using the Composition API (`<script setup>`).
277
+
278
+ ## 1. Installation
279
+
280
+ Install the core package using npm:
281
+
282
+ ```bash
283
+ npm install @signosoft/signpad-js
284
+ ```
285
+
286
+ ## 2. Configure Vue to recognize Custom Elements
287
+
288
+ By default, Vue will try to resolve `signosoft-signpad` as a Vue component and will throw a warning. You need to tell Vue to ignore this tag.
289
+
290
+ **If you are using Vite (`vite.config.ts`):**
291
+
292
+ ```typescript
293
+ import { defineConfig } from "vite";
294
+ import vue from "@vitejs/plugin-vue";
295
+
296
+ export default defineConfig({
297
+ plugins: [
298
+ vue({
299
+ template: {
300
+ compilerOptions: {
301
+ // Treat all tags starting with 'signosoft-' as custom elements
302
+ isCustomElement: (tag) => tag.startsWith("signosoft-"),
303
+ },
304
+ },
305
+ }),
306
+ ],
307
+ });
308
+ ```
309
+
310
+ ## 3. Implementation
311
+
312
+ In Vue 3, we use `ref` to hold the reference to the DOM element and pass the configuration via the `:config` attribute.
313
+
314
+ ```typescript
315
+ <script setup lang="ts">
316
+ import { ref } from "vue";
317
+ import "@signosoft/signpad-js"; // Registers the Web Component
318
+ import type { SignpadConfig, SignosoftSignpad, IPenData } from "@signosoft/signpad-js";
319
+
320
+ // Use ref to access component methods (ok, clear, connect, etc. by signpadRef.value)
321
+ const signpadRef = ref<SignosoftSignpad | null>(null);
322
+
323
+ const signpadConfig: SignpadConfig = {
324
+ licenseKey: "YOUR-LICENSE-KEY",
325
+ // More info in "properties" section
326
+ };
327
+
328
+ </script>
329
+
330
+ <template>
331
+ <div>
332
+ <signosoft-signpad
333
+ ref="signpadRef"
334
+ :config="signpadConfig"
335
+ ></signosoft-signpad>
336
+ </div>
337
+ </template>
338
+ ```
339
+
340
+ </details>
341
+
342
+ <details>
343
+ <summary>
344
+ <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/javascript/javascript-original.svg" alt="JS" width="15" height="15">
345
+ <b>Vanilla JS</b> <font color="green"><b>(Live)</b></font>
346
+ </summary>
347
+ <br>
348
+
349
+ # 🍦 Vanilla JS Integration Guide
350
+
351
+ This guide describes how to integrate the `@signosoft/signpad-js` web component into a plain JavaScript project without any frameworks.
352
+
353
+ ## 1. Installation
354
+
355
+ Install the package via npm:
356
+
357
+ ```bash
358
+ npm install @signosoft/signpad-js
359
+ ```
360
+
361
+ Or, if you are not using a bundler, you can include the script directly in your HTML (ensure the path points to the compiled bundle in `node_modules` or a CDN).
362
+
363
+ ## 2. JavaScript Implementation
364
+
365
+ In Vanilla JS, you interact with the component by selecting it from the DOM and assigning the configuration directly to its `config` property.
366
+
367
+ ```javascript
368
+ import "@signosoft/signpad-js";
369
+
370
+ /**
371
+ * INTELLISENSE SUPPORT (Optional)
372
+ * Helps VS Code provide autocomplete for methods and properties.
373
+ * @type {import('@signosoft/signpad-js').SignosoftSignpad}
374
+ */
375
+ const pad = document.querySelector("signosoft-signpad");
376
+
377
+ // 1. Initial Configuration
378
+ pad.config = {
379
+ licenseKey: "YOUR-LICENSE-KEY",
380
+ };
381
+ ```
382
+
383
+ ## 3. HTML Structure
384
+
385
+ Add the custom element tag to your HTML and create the necessary control buttons.
386
+
387
+ ```html
388
+ <!-- index.html -->
389
+ <!DOCTYPE html>
390
+ <html lang="en">
391
+ <head>
392
+ <meta charset="UTF-8" />
393
+ <title>Signosoft Signpad - Vanilla JS</title>
394
+ </head>
395
+ <body>
396
+ <h1>Signosoft Signpad</h1>
397
+ <!-- The Web Component -->
398
+ <signosoft-signpad id="my-signpad"></signosoft-signpad>
399
+ <!-- Main logic script -->
400
+ <script type="module" src="main.js"></script>
401
+ </body>
402
+ </html>
403
+ ```
404
+
405
+ ## 4. Key Concepts
406
+
407
+ - **Direct Property Assignment:** Unlike some frameworks that use attributes, in Plain JS you should assign the configuration directly: `element.config = { ... }`.
408
+ - **Module System:** Ensure your `<script>` tag has `type="module"` to use the `import` statement.
409
+ - **Methods:** All methods like `.connect()`, `.ok()`, and `.clear()` are available directly on the DOM element object.
410
+ - **DOM Events:** The component dispatches standard DOM events (like `sign-ok`, `sign-clear`) which you can listen to using `addEventListener`.
411
+
412
+ </details>
116
413
 
117
414
  ## 📋 Properties
118
415
 
package/docsVideo.gif ADDED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signosoft/signpad-js",
3
3
  "private": false,
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "type": "module",
6
6
  "main": "./dist/signosoft-signpad.umd.cjs",
7
7
  "module": "./dist/signosoft-signpad.js",
@@ -25,10 +25,10 @@
25
25
  "src/scripts/generate-theme.js",
26
26
  "src/styles/styles-variables.css",
27
27
  "src/styles/signosoft-signpad.css",
28
+ "docsVideo.gif",
28
29
  "package.json",
29
30
  "README.md",
30
- "LICENSE",
31
- "framework-docs"
31
+ "LICENSE"
32
32
  ],
33
33
  "scripts": {
34
34
  "dev": "vite",
@@ -1,100 +0,0 @@
1
- # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/angular/angular-original.svg" alt="Angular" width="30" height="30"> Angular Integration Guide
2
-
3
- This guide describes how to integrate the `@signosoft/signpad-js` web component into an Angular application.
4
-
5
- ## 1. Installation
6
-
7
- Install the core package using npm:
8
-
9
- ```bash
10
- npm install @signosoft/signpad-js
11
- ```
12
-
13
- ## 2. Create the Bridge Directive
14
-
15
- Since `signosoft-signpad` is a Web Component, Angular requires a Directive to properly sync configuration changes and provide typed access to the component instance.
16
-
17
- Create `signosoft-signpad.directive.ts`:
18
-
19
- ```typescript
20
- import {
21
- Directive,
22
- ElementRef,
23
- Input,
24
- OnChanges,
25
- SimpleChanges,
26
- } from "@angular/core";
27
- import type { SignosoftSignpad, SignpadConfig } from "@signosoft/signpad-js";
28
-
29
- @Directive({
30
- selector: "signosoft-signpad",
31
- standalone: true,
32
- })
33
- export class SignosoftSignpadDirective implements OnChanges {
34
- @Input() config?: SignpadConfig;
35
-
36
- constructor(private host: ElementRef<SignosoftSignpad>) {}
37
-
38
- // Access the native Web Component instance
39
- get signpadRef(): SignosoftSignpad {
40
- return this.host.nativeElement;
41
- }
42
-
43
- ngOnChanges(changes: SimpleChanges) {
44
- const el = this.host.nativeElement as any;
45
- for (const key of Object.keys(changes)) {
46
- el[key] = (this as any)[key];
47
- }
48
- }
49
- }
50
- ```
51
-
52
- ## 3. Implementation in Component
53
-
54
- Import the library, the directive, and add the **`CUSTOM_ELEMENTS_SCHEMA`**.
55
-
56
- ```typescript
57
- import { Component, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
58
- import "@signosoft/signpad-js"; // Import the Web Component registration
59
- import {
60
- type SignosoftSignpad,
61
- type SignpadConfig,
62
- } from "@signosoft/signpad-js";
63
- import { SignosoftSignpadDirective } from "./directives/signosoft-signpad.directive";
64
-
65
- @Component({
66
- selector: "app-root",
67
- standalone: true,
68
- imports: [SignosoftSignpadDirective],
69
- templateUrl: "./app.component.html",
70
- schemas: [CUSTOM_ELEMENTS_SCHEMA], // Mandatory for custom HTML tags
71
- })
72
- export class AppComponent {
73
- @ViewChild(SignosoftSignpadDirective)
74
- signpadDirective!: SignosoftSignpadDirective;
75
-
76
- config: SignpadConfig = {
77
- licenseKey: "YOUR-LICENSE-KEY",
78
- // More info in "properties" section
79
- };
80
-
81
- // Helper to access methods easily (ok, clear, cancel, etc.)
82
- public get signpad(): SignosoftSignpad | undefined {
83
- return this.signpadDirective?.signpadRef;
84
- }
85
- }
86
- ```
87
-
88
- ## 4. Component Template
89
-
90
- Use the custom tag in your HTML and bind the configuration object.
91
-
92
- ```html
93
- <div>
94
- <div>
95
- <signosoft-signpad [config]="config"></signosoft-signpad>
96
- </div>
97
- </div>
98
- ```
99
-
100
- ### [← Back to Main README](../README.md)
@@ -1,64 +0,0 @@
1
- # 🍦 Vanilla JS Integration Guide
2
-
3
- This guide describes how to integrate the `@signosoft/signpad-js` web component into a plain JavaScript project without any frameworks.
4
-
5
- ## 1. Installation
6
-
7
- Install the package via npm:
8
-
9
- ```bash
10
- npm install @signosoft/signpad-js
11
- ```
12
-
13
- Or, if you are not using a bundler, you can include the script directly in your HTML (ensure the path points to the compiled bundle in `node_modules` or a CDN).
14
-
15
- ## 2. JavaScript Implementation
16
-
17
- In Vanilla JS, you interact with the component by selecting it from the DOM and assigning the configuration directly to its `config` property.
18
-
19
- ```javascript
20
- import "@signosoft/signpad-js";
21
-
22
- /**
23
- * INTELLISENSE SUPPORT (Optional)
24
- * Helps VS Code provide autocomplete for methods and properties.
25
- * @type {import('@signosoft/signpad-js').SignosoftSignpad}
26
- */
27
- const pad = document.querySelector("signosoft-signpad");
28
-
29
- // 1. Initial Configuration
30
- pad.config = {
31
- licenseKey: "YOUR-LICENSE-KEY",
32
- };
33
- ```
34
-
35
- ## 3. HTML Structure
36
-
37
- Add the custom element tag to your HTML and create the necessary control buttons.
38
-
39
- ```html
40
- <!-- index.html -->
41
- <!DOCTYPE html>
42
- <html lang="en">
43
- <head>
44
- <meta charset="UTF-8" />
45
- <title>Signosoft Signpad - Vanilla JS</title>
46
- </head>
47
- <body>
48
- <h1>Signosoft Signpad</h1>
49
- <!-- The Web Component -->
50
- <signosoft-signpad id="my-signpad"></signosoft-signpad>
51
- <!-- Main logic script -->
52
- <script type="module" src="main.js"></script>
53
- </body>
54
- </html>
55
- ```
56
-
57
- ## 4. Key Concepts
58
-
59
- - **Direct Property Assignment:** Unlike some frameworks that use attributes, in Plain JS you should assign the configuration directly: `element.config = { ... }`.
60
- - **Module System:** Ensure your `<script>` tag has `type="module"` to use the `import` statement.
61
- - **Methods:** All methods like `.connect()`, `.ok()`, and `.clear()` are available directly on the DOM element object.
62
- - **DOM Events:** The component dispatches standard DOM events (like `sign-ok`, `sign-clear`) which you can listen to using `addEventListener`.
63
-
64
- ### [← Back to Main README](../README.md)
@@ -1,42 +0,0 @@
1
- # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/react/react-original.svg" alt="React" width="30" height="30"> React - Quick start
2
-
3
- This guide describes how to integrate the `@signosoft/signpad-js` web component into a React application (Functional Components with Hooks).
4
-
5
- ## 1. Installation
6
-
7
- Install the core package using npm:
8
-
9
- ```bash
10
- npm install @signosoft/signpad-js
11
- ```
12
-
13
- ## 2. Implementation
14
-
15
- In React, we use the `useRef` hook to interact with the component's methods (like `ok()` or `clear()`) and pass the configuration directly via props.
16
-
17
- ```tsx
18
- import { useRef } from "react";
19
- import "@signosoft/signpad-js"; // Registers the web component
20
- import type { SignpadConfig } from "@signosoft/signpad-js";
21
-
22
- function App() {
23
- // Use ref to access component methods (ok, clear, connect, etc. by signpadRef.current)
24
- const signpadRef = useRef<any>(null);
25
-
26
- const config: SignpadConfig = {
27
- licenseKey: "YOUR-LICENSE-KEY",
28
- // More info in "properties" section
29
- };
30
-
31
- return (
32
- <div>
33
- <h1>Signosoft Signpad React Example</h1>
34
- <signosoft-signpad ref={signpadRef} config={config} />
35
- </div>
36
- );
37
- }
38
-
39
- export default App;
40
- ```
41
-
42
- ### [← Back to Main README](../README.md)
@@ -1,67 +0,0 @@
1
- # <img src="https://cdn.jsdelivr.net/gh/devicons/devicon/icons/vuejs/vuejs-original.svg" alt="Vue" width="30" height="30"> Vue.js Integration Guide
2
-
3
- This guide describes how to integrate the `@signosoft/signpad-js` web component into a Vue 3 application using the Composition API (`<script setup>`).
4
-
5
- ## 1. Installation
6
-
7
- Install the core package using npm:
8
-
9
- ```bash
10
- npm install @signosoft/signpad-js
11
- ```
12
-
13
- ## 2. Configure Vue to recognize Custom Elements
14
-
15
- By default, Vue will try to resolve `signosoft-signpad` as a Vue component and will throw a warning. You need to tell Vue to ignore this tag.
16
-
17
- **If you are using Vite (`vite.config.ts`):**
18
-
19
- ```typescript
20
- import { defineConfig } from "vite";
21
- import vue from "@vitejs/plugin-vue";
22
-
23
- export default defineConfig({
24
- plugins: [
25
- vue({
26
- template: {
27
- compilerOptions: {
28
- // Treat all tags starting with 'signosoft-' as custom elements
29
- isCustomElement: (tag) => tag.startsWith("signosoft-"),
30
- },
31
- },
32
- }),
33
- ],
34
- });
35
- ```
36
-
37
- ## 3. Implementation
38
-
39
- In Vue 3, we use `ref` to hold the reference to the DOM element and pass the configuration via the `:config` attribute.
40
-
41
- ```typescript
42
- <script setup lang="ts">
43
- import { ref } from "vue";
44
- import "@signosoft/signpad-js"; // Registers the Web Component
45
- import type { SignpadConfig, SignosoftSignpad, IPenData } from "@signosoft/signpad-js";
46
-
47
- // Use ref to access component methods (ok, clear, connect, etc. by signpadRef.value)
48
- const signpadRef = ref<SignosoftSignpad | null>(null);
49
-
50
- const signpadConfig: SignpadConfig = {
51
- licenseKey: "YOUR-LICENSE-KEY",
52
- // More info in "properties" section
53
- };
54
-
55
- </script>
56
-
57
- <template>
58
- <div>
59
- <signosoft-signpad
60
- ref="signpadRef"
61
- :config="signpadConfig"
62
- ></signosoft-signpad>
63
- </div>
64
- </template>
65
- ```
66
-
67
- ### [← Back to Main README](../README.md)