@getsigil/core 0.1.0
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/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/sigil.cjs +549 -0
- package/dist/sigil.d.cts +83 -0
- package/dist/sigil.d.ts +83 -0
- package/dist/sigil.js +524 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Iridium Softworks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# @getsigil/core
|
|
2
|
+
|
|
3
|
+
Visual markers for automated UI testing - client-side library for [Sigil](https://usesigil.dev).
|
|
4
|
+
|
|
5
|
+
This package renders visual glyph markers on interactive elements, enabling zero-config browser automation with the Sigil executor.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @getsigil/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Automatic (Recommended)
|
|
16
|
+
|
|
17
|
+
When using the Sigil executor with `--auto-mark`, this library is injected automatically via CDP. No installation required.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
sigil run test.sigil --address http://localhost:3000 --auto-mark
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Manual Integration
|
|
24
|
+
|
|
25
|
+
For explicit control over which elements get markers:
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import { Sigil } from '@getsigil/core';
|
|
29
|
+
|
|
30
|
+
// Initialize (typically in development only)
|
|
31
|
+
Sigil.init({
|
|
32
|
+
enabled: process.env.NODE_ENV === 'development',
|
|
33
|
+
wsPort: 5050
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then add `data-sigil-id` attributes to elements you want to mark:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<button data-sigil-id="submit-btn">Submit</button>
|
|
41
|
+
<input data-sigil-id="email-input" type="email" />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Auto-Discovery
|
|
45
|
+
|
|
46
|
+
Automatically discover and mark all interactive elements:
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import { Sigil } from '@getsigil/core';
|
|
50
|
+
|
|
51
|
+
Sigil.init({ enabled: true });
|
|
52
|
+
Sigil.autoDiscover(); // Marks buttons, inputs, links, etc.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## API
|
|
56
|
+
|
|
57
|
+
### `Sigil.init(config)`
|
|
58
|
+
|
|
59
|
+
Initialize the marker system.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
interface SigilConfig {
|
|
63
|
+
enabled?: boolean; // Enable/disable markers (default: true)
|
|
64
|
+
position?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
65
|
+
zIndex?: number; // Z-index for markers (default: 9999)
|
|
66
|
+
opacity?: number; // Marker opacity 0-1 (default: 1)
|
|
67
|
+
wsPort?: number; // WebSocket port for executor (default: 5050)
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `Sigil.scan(root?)`
|
|
72
|
+
|
|
73
|
+
Scan DOM for `data-sigil-id` elements and add markers. Called automatically on init.
|
|
74
|
+
|
|
75
|
+
### `Sigil.autoDiscover()`
|
|
76
|
+
|
|
77
|
+
Auto-discover interactive elements and generate `data-sigil-id` attributes.
|
|
78
|
+
|
|
79
|
+
### `Sigil.show()` / `Sigil.hide()`
|
|
80
|
+
|
|
81
|
+
Toggle marker visibility.
|
|
82
|
+
|
|
83
|
+
### `Sigil.dispose()`
|
|
84
|
+
|
|
85
|
+
Clean up all markers and disconnect.
|
|
86
|
+
|
|
87
|
+
## Framework Examples
|
|
88
|
+
|
|
89
|
+
### React
|
|
90
|
+
|
|
91
|
+
```jsx
|
|
92
|
+
import { useEffect } from 'react';
|
|
93
|
+
import { Sigil } from '@getsigil/core';
|
|
94
|
+
|
|
95
|
+
function App() {
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (process.env.NODE_ENV === 'development') {
|
|
98
|
+
Sigil.init({ enabled: true });
|
|
99
|
+
}
|
|
100
|
+
return () => Sigil.dispose();
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<button data-sigil-id="submit">Submit</button>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Vue
|
|
110
|
+
|
|
111
|
+
```vue
|
|
112
|
+
<script setup>
|
|
113
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
114
|
+
import { Sigil } from '@getsigil/core';
|
|
115
|
+
|
|
116
|
+
onMounted(() => {
|
|
117
|
+
if (import.meta.env.DEV) {
|
|
118
|
+
Sigil.init({ enabled: true });
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
onUnmounted(() => Sigil.dispose());
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<template>
|
|
126
|
+
<button data-sigil-id="submit">Submit</button>
|
|
127
|
+
</template>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Vanilla JS
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<script type="module">
|
|
134
|
+
import { Sigil } from 'https://unpkg.com/@getsigil/core';
|
|
135
|
+
Sigil.init({ enabled: true });
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<button data-sigil-id="submit">Submit</button>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## How It Works
|
|
142
|
+
|
|
143
|
+
Sigil renders small colored glyph markers on elements with `data-sigil-id` attributes. Each marker encodes the element's ID using a unique color pattern that the Sigil executor can detect via screenshot analysis - no DOM access required.
|
|
144
|
+
|
|
145
|
+
This enables reliable UI automation that works with any web framework, including those with shadow DOM, iframes, or complex rendering.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT
|