popup-button-plugin 0.1.1 → 0.1.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/README.md CHANGED
@@ -10,6 +10,18 @@ See the full design write-up and integration steps in
10
10
  [popup-button-prd.md](./popup-button-prd.md) and
11
11
  [popup-button-integration-guide.md](./popup-button-integration-guide.md).
12
12
 
13
+ ## Supported languages / frameworks (tested)
14
+
15
+ | Language / Framework | Supported | Example |
16
+ |---|---|---|
17
+ | Plain HTML | ✅ | `examples/html/` |
18
+ | React | ✅ | `examples/react-app/` |
19
+ | Vue | ✅ | `examples/vue-app/` |
20
+ | Svelte | ✅ | `examples/svelte-app/` |
21
+ | Angular | ✅ | `examples/angular-app/` |
22
+ | Flutter | ❌ not supported | — |
23
+ | React Native | ❌ not supported | — |
24
+
13
25
  ## Quick start
14
26
 
15
27
  ```bash
@@ -9,8 +9,18 @@ export declare class PopupButton extends HTMLElement {
9
9
  connectedCallback(): void;
10
10
  /** Reads the `name` HTML attribute, e.g. <popup-button name="save-info">. */
11
11
  private get buttonName();
12
- /** Reads the `label` HTML attribute (button text), with a default. */
13
- private get label();
12
+ /**
13
+ * Reads the `label` HTML attribute (button text), with a default.
14
+ *
15
+ * NOTE: named `buttonLabel`, NOT `label` — React 19 sets custom
16
+ * element props as real DOM properties (`el.label = '...'`) when
17
+ * the property exists on the element. A getter-only `label` here
18
+ * (no setter) would make that assignment throw
19
+ * "Cannot set property label ... which has only a getter" and
20
+ * crash the whole React render. Avoid naming internal accessors
21
+ * the same as attributes a framework might try to set directly.
22
+ */
23
+ private get buttonLabel();
14
24
  /** Runs when the visible <button> inside our shadow DOM is clicked. */
15
25
  private handleButtonClick;
16
26
  /** Runs when the popup's close button or backdrop is clicked. */
@@ -68,8 +68,18 @@ export class PopupButton extends HTMLElement {
68
68
  var _a;
69
69
  return (_a = this.getAttribute('name')) !== null && _a !== void 0 ? _a : '';
70
70
  }
71
- /** Reads the `label` HTML attribute (button text), with a default. */
72
- get label() {
71
+ /**
72
+ * Reads the `label` HTML attribute (button text), with a default.
73
+ *
74
+ * NOTE: named `buttonLabel`, NOT `label` — React 19 sets custom
75
+ * element props as real DOM properties (`el.label = '...'`) when
76
+ * the property exists on the element. A getter-only `label` here
77
+ * (no setter) would make that assignment throw
78
+ * "Cannot set property label ... which has only a getter" and
79
+ * crash the whole React render. Avoid naming internal accessors
80
+ * the same as attributes a framework might try to set directly.
81
+ */
82
+ get buttonLabel() {
73
83
  var _a;
74
84
  return (_a = this.getAttribute('label')) !== null && _a !== void 0 ? _a : 'Click me';
75
85
  }
@@ -82,7 +92,7 @@ export class PopupButton extends HTMLElement {
82
92
  const shadow = this.shadowRoot;
83
93
  shadow.innerHTML = `
84
94
  <style>${STYLES}</style>
85
- <button class="btn">${escapeHtml(this.label)}</button>
95
+ <button class="btn">${escapeHtml(this.buttonLabel)}</button>
86
96
  ${this.isOpen ? this.renderPopupMarkup() : ''}
87
97
  `;
88
98
  // Re-attach listeners every render, since innerHTML = '...' above
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "popup-button-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A tiny, standalone, framework-free button-with-popup web component: register content by name, and <popup-button name=\"...\"> automatically shows it when clicked.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",