@pixelmatters/markup 1.27.1 → 1.27.3
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 +8 -8
- package/dist/widget.d.ts +7 -3
- package/dist/widget.js +612 -539
- package/dist/widget.js.map +1 -1
- package/package.json +1 -1
- package/skills/install-markup-widget/SKILL.md +4 -4
package/README.md
CHANGED
|
@@ -37,9 +37,9 @@ CDN drop-in, no build step. Paste this just before `</body>`:
|
|
|
37
37
|
```html
|
|
38
38
|
<script type="module">
|
|
39
39
|
// Pin the exact version; esm.sh resolves it from npm
|
|
40
|
-
import { init } from 'https://esm.sh/@pixelmatters/markup@1.27.
|
|
40
|
+
import { init } from 'https://esm.sh/@pixelmatters/markup@1.27.3'
|
|
41
41
|
// or
|
|
42
|
-
// import { init } from 'https://esm.run/@pixelmatters/markup@1.27.
|
|
42
|
+
// import { init } from 'https://esm.run/@pixelmatters/markup@1.27.3'
|
|
43
43
|
|
|
44
44
|
init({
|
|
45
45
|
apiUrl: 'https://your-deployment.convex.site',
|
|
@@ -50,14 +50,14 @@ CDN drop-in, no build step. Paste this just before `</body>`:
|
|
|
50
50
|
</script>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
> **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm, so a future major release will break your page with no warning. Always pin (`@pixelmatters/markup@1.27.
|
|
53
|
+
> **Why pin the version?** CDN URLs without a version (`@pixelmatters/markup`) resolve to whatever's `latest` on npm, so a future major release will break your page with no warning. Always pin (`@pixelmatters/markup@1.27.3`).
|
|
54
54
|
|
|
55
55
|
If your platform doesn't allow inline JS (some CMS / page-builder editors), use the auto-init form instead. Point a `<script src=…>` at the bundle and pass config via `data-*` attributes:
|
|
56
56
|
|
|
57
57
|
```html
|
|
58
58
|
<script
|
|
59
59
|
type="module"
|
|
60
|
-
src="https://esm.sh/@pixelmatters/markup@1.27.
|
|
60
|
+
src="https://esm.sh/@pixelmatters/markup@1.27.3"
|
|
61
61
|
data-markup-widget="true"
|
|
62
62
|
data-api-url="https://your-deployment.convex.site"
|
|
63
63
|
data-api-key="markup_..."
|
|
@@ -83,7 +83,7 @@ const stop = init({
|
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
// Tear down on logout / route change / page unload:
|
|
86
|
-
stop() //
|
|
86
|
+
stop() // tears down this instance; the exported destroy() tears down whichever is mounted
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
### React
|
|
@@ -151,7 +151,7 @@ export default function App() {
|
|
|
151
151
|
|
|
152
152
|
### `init(config) → destroy`
|
|
153
153
|
|
|
154
|
-
Mounts the widget
|
|
154
|
+
Mounts the widget and returns a function that tears down that instance. Once a later `init` has replaced it, the returned function does nothing, so a stale cleanup can't remove its successor. Calling `init` again with an equal config is a no-op, so the live instance keeps its connection and any unsent draft. A different config tears the existing instance down before mounting. If your page removed the widget's host element (a body swap on navigation, say), the next `init` mounts it again.
|
|
155
155
|
|
|
156
156
|
| Option | Type | Default | Description |
|
|
157
157
|
| -------------- | ---------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -457,7 +457,7 @@ For a `<script>` tag drop-in (no bundler), use the inline ESM form and **pin the
|
|
|
457
457
|
|
|
458
458
|
```html
|
|
459
459
|
<script type="module">
|
|
460
|
-
import { init } from 'https://esm.sh/@pixelmatters/markup@1.27.
|
|
460
|
+
import { init } from 'https://esm.sh/@pixelmatters/markup@1.27.3'
|
|
461
461
|
|
|
462
462
|
init({
|
|
463
463
|
apiUrl: '...',
|
|
@@ -473,7 +473,7 @@ If inline JS is disallowed (some CMS / page-builder editors), use the auto-init
|
|
|
473
473
|
```html
|
|
474
474
|
<script
|
|
475
475
|
type="module"
|
|
476
|
-
src="https://esm.sh/@pixelmatters/markup@1.27.
|
|
476
|
+
src="https://esm.sh/@pixelmatters/markup@1.27.3"
|
|
477
477
|
data-markup-widget="true"
|
|
478
478
|
data-api-url="..."
|
|
479
479
|
data-api-key="..."
|
package/dist/widget.d.ts
CHANGED
|
@@ -134,10 +134,14 @@ export interface WidgetConfig {
|
|
|
134
134
|
/**
|
|
135
135
|
* Mounts the feedback widget on the page. Idempotent — calling init again
|
|
136
136
|
* with the same config is a no-op; calling with different config tears down
|
|
137
|
-
* the previous instance first.
|
|
137
|
+
* the previous instance first. A host removed from the document by the page
|
|
138
|
+
* (a body swap on navigation, say) is remounted even when the config matches.
|
|
138
139
|
*
|
|
139
|
-
* Returns a
|
|
140
|
-
*
|
|
140
|
+
* Returns a function that unmounts this instance and removes its host
|
|
141
|
+
* element. Once a later `init()` has replaced the instance it does nothing,
|
|
142
|
+
* so a stale cleanup can't tear down its successor. Callers that got the same
|
|
143
|
+
* instance back from an equal config share it, and either one's cleanup
|
|
144
|
+
* removes it.
|
|
141
145
|
*/
|
|
142
146
|
export declare function init(config: WidgetConfig): () => void;
|
|
143
147
|
export declare function destroy(): void;
|