@signosoft/signpad-js 0.2.0 → 0.2.2

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/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.2",
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)