@squeletteapp/widget-react 0.1.1 → 1.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/dist/components/changelog-banner.d.ts +11 -0
- package/dist/components/changelog-banner.js +44 -0
- package/dist/components/changelog-entries-list-dropdown.d.ts +14 -0
- package/dist/components/changelog-entries-list-dropdown.js +50 -0
- package/dist/components/changelog-entry-modal.d.ts +11 -0
- package/dist/components/changelog-entry-modal.js +34 -0
- package/dist/context.d.ts +53 -0
- package/dist/context.js +41 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.esm.js +133 -334
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +132 -321
- package/dist/index.js.map +4 -4
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/package.json +7 -5
- package/dist/components.d.ts +0 -27
- package/dist/components.js +0 -39
- package/dist/hooks.d.ts +0 -20
- package/dist/hooks.js +0 -143
package/dist/index.js
CHANGED
|
@@ -30,351 +30,162 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
createRoadmapWidget: () => import_widget2.createRoadmapWidget,
|
|
39
|
-
createWidget: () => import_widget2.createWidget,
|
|
40
|
-
useChangelogWidget: () => useChangelogWidget,
|
|
41
|
-
useFeedbackWidget: () => useFeedbackWidget,
|
|
42
|
-
useRoadmapWidget: () => useRoadmapWidget,
|
|
43
|
-
useWidget: () => useWidget
|
|
33
|
+
ChangelogBanner: () => ChangelogBanner,
|
|
34
|
+
ChangelogEntriesListDropdown: () => ChangelogEntriesListDropdown,
|
|
35
|
+
ChangelogEntryModal: () => ChangelogEntryModal,
|
|
36
|
+
ChangelogProvider: () => ChangelogProvider,
|
|
37
|
+
useChangelogContext: () => useChangelogContext
|
|
44
38
|
});
|
|
45
39
|
module.exports = __toCommonJS(index_exports);
|
|
46
|
-
var import_widget2 = require("@squeletteapp/widget");
|
|
47
40
|
|
|
48
|
-
//
|
|
49
|
-
var React2 = __toESM(require("react"), 1);
|
|
50
|
-
|
|
51
|
-
// ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
41
|
+
// src/context.tsx
|
|
52
42
|
var React = __toESM(require("react"), 1);
|
|
53
|
-
function setRef(ref, value) {
|
|
54
|
-
if (typeof ref === "function") {
|
|
55
|
-
return ref(value);
|
|
56
|
-
} else if (ref !== null && ref !== void 0) {
|
|
57
|
-
ref.current = value;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function composeRefs(...refs) {
|
|
61
|
-
return (node) => {
|
|
62
|
-
let hasCleanup = false;
|
|
63
|
-
const cleanups = refs.map((ref) => {
|
|
64
|
-
const cleanup = setRef(ref, node);
|
|
65
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
66
|
-
hasCleanup = true;
|
|
67
|
-
}
|
|
68
|
-
return cleanup;
|
|
69
|
-
});
|
|
70
|
-
if (hasCleanup) {
|
|
71
|
-
return () => {
|
|
72
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
73
|
-
const cleanup = cleanups[i];
|
|
74
|
-
if (typeof cleanup == "function") {
|
|
75
|
-
cleanup();
|
|
76
|
-
} else {
|
|
77
|
-
setRef(refs[i], null);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ../../node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
86
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
87
|
-
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return child;
|
|
102
|
-
}
|
|
44
|
+
var ChangelogContext = React.createContext(null);
|
|
45
|
+
function ChangelogProvider({
|
|
46
|
+
children,
|
|
47
|
+
slug,
|
|
48
|
+
theme = "light",
|
|
49
|
+
base
|
|
50
|
+
}) {
|
|
51
|
+
const [context, setContext] = React.useState(null);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
import("@squeletteapp/widget").then((mod) => {
|
|
54
|
+
const widgetModule = mod;
|
|
55
|
+
setContext({
|
|
56
|
+
store: widgetModule.createChangelogStore(),
|
|
57
|
+
module: widgetModule
|
|
103
58
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
112
|
-
// @__NO_SIDE_EFFECTS__
|
|
113
|
-
function createSlotClone(ownerName) {
|
|
114
|
-
const SlotClone = React2.forwardRef((props, forwardedRef) => {
|
|
115
|
-
const { children, ...slotProps } = props;
|
|
116
|
-
if (React2.isValidElement(children)) {
|
|
117
|
-
const childrenRef = getElementRef(children);
|
|
118
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
119
|
-
if (children.type !== React2.Fragment) {
|
|
120
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
121
|
-
}
|
|
122
|
-
return React2.cloneElement(children, props2);
|
|
123
|
-
}
|
|
124
|
-
return React2.Children.count(children) > 1 ? React2.Children.only(null) : null;
|
|
125
|
-
});
|
|
126
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
127
|
-
return SlotClone;
|
|
128
|
-
}
|
|
129
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
130
|
-
function isSlottable(child) {
|
|
131
|
-
return React2.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
132
|
-
}
|
|
133
|
-
function mergeProps(slotProps, childProps) {
|
|
134
|
-
const overrideProps = { ...childProps };
|
|
135
|
-
for (const propName in childProps) {
|
|
136
|
-
const slotPropValue = slotProps[propName];
|
|
137
|
-
const childPropValue = childProps[propName];
|
|
138
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
139
|
-
if (isHandler) {
|
|
140
|
-
if (slotPropValue && childPropValue) {
|
|
141
|
-
overrideProps[propName] = (...args) => {
|
|
142
|
-
const result = childPropValue(...args);
|
|
143
|
-
slotPropValue(...args);
|
|
144
|
-
return result;
|
|
145
|
-
};
|
|
146
|
-
} else if (slotPropValue) {
|
|
147
|
-
overrideProps[propName] = slotPropValue;
|
|
148
|
-
}
|
|
149
|
-
} else if (propName === "style") {
|
|
150
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
151
|
-
} else if (propName === "className") {
|
|
152
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
153
|
-
}
|
|
59
|
+
});
|
|
60
|
+
}, []);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
context?.store.setTheme(theme);
|
|
63
|
+
}, [context, theme]);
|
|
64
|
+
if (!context) {
|
|
65
|
+
return null;
|
|
154
66
|
}
|
|
155
|
-
return
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
ChangelogContext.Provider,
|
|
69
|
+
{
|
|
70
|
+
value: { store: context.store, module: context.module, theme, base, slug },
|
|
71
|
+
children
|
|
72
|
+
}
|
|
73
|
+
);
|
|
156
74
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return element.ref;
|
|
162
|
-
}
|
|
163
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
164
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
165
|
-
if (mayWarn) {
|
|
166
|
-
return element.props.ref;
|
|
75
|
+
function useChangelogContext() {
|
|
76
|
+
const context = React.useContext(ChangelogContext);
|
|
77
|
+
if (!context) {
|
|
78
|
+
throw new Error("useChangelogContext must be used within a ChangelogProvider");
|
|
167
79
|
}
|
|
168
|
-
return
|
|
80
|
+
return context;
|
|
169
81
|
}
|
|
170
82
|
|
|
171
|
-
// src/components.tsx
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const widgetRef =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
const element = document.querySelector(options.buttonSelector);
|
|
186
|
-
if (!element) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
widgetRef.current = (0, import_widget.createFeedbackWidget)(workspaceSlug, boardSlug, {
|
|
190
|
-
...options,
|
|
191
|
-
onOpenChange: onOpenChangeRef.current ? (isOpen) => onOpenChangeRef.current?.(isOpen) : void 0
|
|
192
|
-
});
|
|
193
|
-
return widgetRef.current;
|
|
194
|
-
}, [
|
|
195
|
-
workspaceSlug,
|
|
196
|
-
boardSlug,
|
|
197
|
-
options.buttonSelector,
|
|
198
|
-
options.position,
|
|
199
|
-
options.theme,
|
|
200
|
-
options.onLoad
|
|
201
|
-
]);
|
|
202
|
-
(0, import_react.useEffect)(() => {
|
|
203
|
-
const frame = requestAnimationFrame(() => {
|
|
204
|
-
const widget = initWidget();
|
|
205
|
-
widgetRef.current = widget;
|
|
83
|
+
// src/components/changelog-entry-modal.tsx
|
|
84
|
+
var React2 = __toESM(require("react"), 1);
|
|
85
|
+
function ChangelogEntryModal({
|
|
86
|
+
ticketId,
|
|
87
|
+
onOpenChange
|
|
88
|
+
}) {
|
|
89
|
+
const { store, module: module2, theme, base, slug } = useChangelogContext();
|
|
90
|
+
const widgetRef = React2.useRef(null);
|
|
91
|
+
React2.useEffect(() => {
|
|
92
|
+
const widget = module2.createChangelogEntryWidget(ticketId, {
|
|
93
|
+
base,
|
|
94
|
+
contentTheme: theme,
|
|
95
|
+
slug
|
|
206
96
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (widgetRef.current) {
|
|
210
|
-
widgetRef.current.destroy();
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}, [initWidget]);
|
|
214
|
-
return widgetRef.current;
|
|
215
|
-
}
|
|
216
|
-
function useRoadmapWidget(workspaceSlug, boardSlug, options) {
|
|
217
|
-
const widgetRef = (0, import_react.useRef)(null);
|
|
218
|
-
const initWidget = (0, import_react.useCallback)(() => {
|
|
219
|
-
if (widgetRef.current) {
|
|
220
|
-
widgetRef.current.destroy();
|
|
97
|
+
if (onOpenChange) {
|
|
98
|
+
widget.onOpenChange(onOpenChange);
|
|
221
99
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
widgetRef.current = (0, import_widget.createRoadmapWidget)(workspaceSlug, boardSlug, options);
|
|
227
|
-
return widgetRef.current;
|
|
228
|
-
}, [workspaceSlug, boardSlug, options]);
|
|
229
|
-
(0, import_react.useEffect)(() => {
|
|
230
|
-
const frame = requestAnimationFrame(() => {
|
|
231
|
-
const widget = initWidget();
|
|
232
|
-
widgetRef.current = widget;
|
|
233
|
-
});
|
|
100
|
+
widgetRef.current = widget;
|
|
101
|
+
store.mount(ticketId, widget);
|
|
234
102
|
return () => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
widgetRef.current.destroy();
|
|
238
|
-
}
|
|
103
|
+
store.unmount(ticketId);
|
|
104
|
+
widgetRef.current = null;
|
|
239
105
|
};
|
|
240
|
-
}, [
|
|
241
|
-
|
|
106
|
+
}, [ticketId, slug, store, module2, base, onOpenChange, theme]);
|
|
107
|
+
React2.useEffect(() => {
|
|
108
|
+
widgetRef.current?.setTheme(theme);
|
|
109
|
+
}, [theme]);
|
|
110
|
+
return null;
|
|
242
111
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
options.theme,
|
|
265
|
-
options.onLoad
|
|
266
|
-
]);
|
|
267
|
-
(0, import_react.useEffect)(() => {
|
|
268
|
-
const frame = requestAnimationFrame(() => {
|
|
269
|
-
const widget = initWidget();
|
|
270
|
-
widgetRef.current = widget;
|
|
271
|
-
});
|
|
272
|
-
return () => {
|
|
273
|
-
cancelAnimationFrame(frame);
|
|
274
|
-
if (widgetRef.current) {
|
|
275
|
-
widgetRef.current.destroy();
|
|
112
|
+
|
|
113
|
+
// src/components/changelog-entries-list-dropdown.tsx
|
|
114
|
+
var React3 = __toESM(require("react"), 1);
|
|
115
|
+
function ChangelogEntriesListDropdown({
|
|
116
|
+
children,
|
|
117
|
+
position
|
|
118
|
+
}) {
|
|
119
|
+
const { store, module: module2, theme, base, slug } = useChangelogContext();
|
|
120
|
+
const widgetRef = React3.useRef(null);
|
|
121
|
+
const anchorId = React3.useId();
|
|
122
|
+
const cleanAnchorId = `sq-dropdown-${anchorId.replace(/:/g, "")}`;
|
|
123
|
+
const initialThemeRef = React3.useRef(theme);
|
|
124
|
+
React3.useEffect(() => {
|
|
125
|
+
const widget = module2.createChangelogEntriesListDropdownWidget(
|
|
126
|
+
`#${cleanAnchorId}`,
|
|
127
|
+
store,
|
|
128
|
+
{
|
|
129
|
+
base,
|
|
130
|
+
contentTheme: initialThemeRef.current,
|
|
131
|
+
slug,
|
|
132
|
+
position
|
|
276
133
|
}
|
|
134
|
+
);
|
|
135
|
+
widget.preload();
|
|
136
|
+
widgetRef.current = widget;
|
|
137
|
+
return () => {
|
|
138
|
+
widget.destroy();
|
|
139
|
+
widgetRef.current = null;
|
|
277
140
|
};
|
|
278
|
-
}, [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
141
|
+
}, [slug, store, module2, base, cleanAnchorId, position]);
|
|
142
|
+
React3.useEffect(() => {
|
|
143
|
+
widgetRef.current?.setTheme(theme);
|
|
144
|
+
}, [theme]);
|
|
145
|
+
const handleClick = React3.useCallback(() => {
|
|
146
|
+
widgetRef.current?.open();
|
|
147
|
+
}, []);
|
|
148
|
+
return React3.cloneElement(children, {
|
|
149
|
+
id: cleanAnchorId,
|
|
150
|
+
onClick: (e) => {
|
|
151
|
+
const originalOnClick = children.props.onClick;
|
|
152
|
+
if (originalOnClick) {
|
|
153
|
+
originalOnClick(e);
|
|
154
|
+
}
|
|
155
|
+
handleClick();
|
|
290
156
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/components/changelog-banner.tsx
|
|
161
|
+
var React4 = __toESM(require("react"), 1);
|
|
162
|
+
function ChangelogBanner({ debug = false }) {
|
|
163
|
+
const { store, module: module2, theme, base, slug } = useChangelogContext();
|
|
164
|
+
const widgetRef = React4.useRef(null);
|
|
165
|
+
const initialThemeRef = React4.useRef(theme);
|
|
166
|
+
React4.useEffect(() => {
|
|
167
|
+
let mounted = true;
|
|
168
|
+
module2.createChangelogBannerWidget(store, {
|
|
169
|
+
base,
|
|
170
|
+
contentTheme: initialThemeRef.current,
|
|
171
|
+
slug,
|
|
172
|
+
debug
|
|
173
|
+
}).then((widget) => {
|
|
174
|
+
if (mounted && widget) {
|
|
175
|
+
widgetRef.current = widget;
|
|
176
|
+
}
|
|
298
177
|
});
|
|
299
178
|
return () => {
|
|
300
|
-
|
|
179
|
+
mounted = false;
|
|
301
180
|
if (widgetRef.current) {
|
|
302
181
|
widgetRef.current.destroy();
|
|
182
|
+
widgetRef.current = null;
|
|
303
183
|
}
|
|
304
184
|
};
|
|
305
|
-
}, [
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
311
|
-
function FeedbackWidget({
|
|
312
|
-
workspaceSlug,
|
|
313
|
-
boardSlug,
|
|
314
|
-
children,
|
|
315
|
-
className,
|
|
316
|
-
asChild = false,
|
|
317
|
-
onOpenChange,
|
|
318
|
-
...options
|
|
319
|
-
}) {
|
|
320
|
-
const buttonId = React3.useId();
|
|
321
|
-
useFeedbackWidget(workspaceSlug, boardSlug, {
|
|
322
|
-
...options,
|
|
323
|
-
buttonSelector: `#${buttonId}`,
|
|
324
|
-
onOpenChange
|
|
325
|
-
});
|
|
326
|
-
if (asChild) {
|
|
327
|
-
return React3.createElement(
|
|
328
|
-
Slot,
|
|
329
|
-
{ className, id: buttonId },
|
|
330
|
-
children
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className, id: buttonId, type: "button", children });
|
|
334
|
-
}
|
|
335
|
-
function RoadmapWidget({
|
|
336
|
-
workspaceSlug,
|
|
337
|
-
boardSlug,
|
|
338
|
-
children,
|
|
339
|
-
className,
|
|
340
|
-
asChild = false,
|
|
341
|
-
...options
|
|
342
|
-
}) {
|
|
343
|
-
const buttonId = React3.useId();
|
|
344
|
-
useRoadmapWidget(workspaceSlug, boardSlug, {
|
|
345
|
-
...options,
|
|
346
|
-
buttonSelector: `#${buttonId}`
|
|
347
|
-
});
|
|
348
|
-
if (asChild) {
|
|
349
|
-
return React3.createElement(
|
|
350
|
-
Slot,
|
|
351
|
-
{ className, id: buttonId },
|
|
352
|
-
children
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className, id: buttonId, type: "button", children });
|
|
356
|
-
}
|
|
357
|
-
function ChangelogWidget({
|
|
358
|
-
workspaceSlug,
|
|
359
|
-
children,
|
|
360
|
-
className,
|
|
361
|
-
asChild = false,
|
|
362
|
-
onOpenChange,
|
|
363
|
-
...options
|
|
364
|
-
}) {
|
|
365
|
-
const buttonId = React3.useId();
|
|
366
|
-
useChangelogWidget(workspaceSlug, {
|
|
367
|
-
...options,
|
|
368
|
-
buttonSelector: `#${buttonId}`,
|
|
369
|
-
onOpenChange
|
|
370
|
-
});
|
|
371
|
-
if (asChild) {
|
|
372
|
-
return React3.createElement(
|
|
373
|
-
Slot,
|
|
374
|
-
{ className, id: buttonId },
|
|
375
|
-
children
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { className, id: buttonId, type: "button", children });
|
|
185
|
+
}, [slug, store, module2, base, debug]);
|
|
186
|
+
React4.useEffect(() => {
|
|
187
|
+
widgetRef.current?.setTheme(theme);
|
|
188
|
+
}, [theme]);
|
|
189
|
+
return null;
|
|
379
190
|
}
|
|
380
191
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "
|
|
4
|
-
"sourcesContent": ["export {\n createChangelogWidget,\n createFeedbackWidget,\n createRoadmapWidget,\n createWidget,\n} from '@squeletteapp/widget';\n\nexport {\n ChangelogWidget,\n type ChangelogWidgetProps,\n FeedbackWidget,\n type FeedbackWidgetProps,\n RoadmapWidget,\n type RoadmapWidgetProps,\n} from './components';\nexport {\n useChangelogWidget,\n useFeedbackWidget,\n useRoadmapWidget,\n useWidget,\n type WidgetInstance,\n type WidgetOptions,\n} from './hooks';\n", "import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n", "import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n", "import { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\nimport {\n useChangelogWidget,\n useFeedbackWidget,\n useRoadmapWidget,\n type WidgetOptions,\n} from './hooks';\n\nexport interface FeedbackWidgetProps\n extends Omit<WidgetOptions, 'buttonSelector'> {\n workspaceSlug: string;\n boardSlug?: string;\n children: React.ReactNode;\n className?: string;\n asChild?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport interface RoadmapWidgetProps\n extends Omit<WidgetOptions, 'buttonSelector'> {\n workspaceSlug: string;\n boardSlug: string;\n children: React.ReactNode;\n className?: string;\n asChild?: boolean;\n}\n\nexport interface ChangelogWidgetProps\n extends Omit<WidgetOptions, 'buttonSelector'> {\n workspaceSlug: string;\n children: React.ReactNode;\n className?: string;\n asChild?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport function FeedbackWidget({\n workspaceSlug,\n boardSlug,\n children,\n className,\n asChild = false,\n onOpenChange,\n ...options\n}: FeedbackWidgetProps) {\n const buttonId = React.useId();\n\n useFeedbackWidget(workspaceSlug, boardSlug, {\n ...options,\n buttonSelector: `#${buttonId}`,\n onOpenChange,\n });\n\n if (asChild) {\n return React.createElement(\n Slot as any,\n { className, id: buttonId },\n children\n );\n }\n\n return (\n <button className={className} id={buttonId} type=\"button\">\n {children}\n </button>\n );\n}\n\nexport function RoadmapWidget({\n workspaceSlug,\n boardSlug,\n children,\n className,\n asChild = false,\n ...options\n}: RoadmapWidgetProps) {\n const buttonId = React.useId();\n\n useRoadmapWidget(workspaceSlug, boardSlug, {\n ...options,\n buttonSelector: `#${buttonId}`,\n });\n\n if (asChild) {\n return React.createElement(\n Slot as any,\n { className, id: buttonId },\n children\n );\n }\n\n return (\n <button className={className} id={buttonId} type=\"button\">\n {children}\n </button>\n );\n}\n\nexport function ChangelogWidget({\n workspaceSlug,\n children,\n className,\n asChild = false,\n onOpenChange,\n ...options\n}: ChangelogWidgetProps) {\n const buttonId = React.useId();\n\n useChangelogWidget(workspaceSlug, {\n ...options,\n buttonSelector: `#${buttonId}`,\n onOpenChange,\n });\n\n if (asChild) {\n return React.createElement(\n Slot as any,\n { className, id: buttonId },\n children\n );\n }\n\n return (\n <button className={className} id={buttonId} type=\"button\">\n {children}\n </button>\n );\n}\n", "import {\n createChangelogWidget,\n createFeedbackWidget,\n createRoadmapWidget,\n createWidget,\n} from '@squeletteapp/widget';\nimport { useCallback, useEffect, useRef } from 'react';\n\nexport interface WidgetOptions {\n buttonSelector: string;\n position?: 'top' | 'bottom' | 'left' | 'right';\n theme?: string;\n onLoad?: () => void;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nexport interface WidgetInstance {\n destroy: () => void;\n}\n\nexport function useFeedbackWidget(\n workspaceSlug: string,\n boardSlug: string | undefined,\n options: WidgetOptions\n): WidgetInstance | null {\n const widgetRef = useRef<WidgetInstance | null>(null);\n const onOpenChangeRef = useRef(options.onOpenChange);\n\n // Always keep the latest onOpenChange callback\n onOpenChangeRef.current = options.onOpenChange;\n\n const initWidget = useCallback(() => {\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n\n const element = document.querySelector(options.buttonSelector);\n if (!element) {\n return null;\n }\n\n widgetRef.current = createFeedbackWidget(workspaceSlug, boardSlug, {\n ...options,\n onOpenChange: onOpenChangeRef.current\n ? (isOpen: boolean) => onOpenChangeRef.current?.(isOpen)\n : undefined,\n });\n return widgetRef.current;\n }, [\n workspaceSlug,\n boardSlug,\n options.buttonSelector,\n options.position,\n options.theme,\n options.onLoad,\n ]);\n\n useEffect(() => {\n // Use requestAnimationFrame to ensure DOM is ready\n const frame = requestAnimationFrame(() => {\n const widget = initWidget();\n widgetRef.current = widget;\n });\n\n return () => {\n cancelAnimationFrame(frame);\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n };\n }, [initWidget]);\n\n return widgetRef.current;\n}\n\nexport function useRoadmapWidget(\n workspaceSlug: string,\n boardSlug: string,\n options: WidgetOptions\n): WidgetInstance | null {\n const widgetRef = useRef<WidgetInstance | null>(null);\n\n const initWidget = useCallback(() => {\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n\n const element = document.querySelector(options.buttonSelector);\n if (!element) {\n return null;\n }\n\n widgetRef.current = createRoadmapWidget(workspaceSlug, boardSlug, options);\n return widgetRef.current;\n }, [workspaceSlug, boardSlug, options]);\n\n useEffect(() => {\n // Use requestAnimationFrame to ensure DOM is ready\n const frame = requestAnimationFrame(() => {\n const widget = initWidget();\n widgetRef.current = widget;\n });\n\n return () => {\n cancelAnimationFrame(frame);\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n };\n }, [initWidget]);\n\n return widgetRef.current;\n}\n\nexport function useChangelogWidget(\n workspaceSlug: string,\n options: WidgetOptions\n): WidgetInstance | null {\n const widgetRef = useRef<WidgetInstance | null>(null);\n const onOpenChangeRef = useRef(options.onOpenChange);\n\n // Always keep the latest onOpenChange callback\n onOpenChangeRef.current = options.onOpenChange;\n\n const initWidget = useCallback(() => {\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n\n const element = document.querySelector(options.buttonSelector);\n if (!element) {\n return null;\n }\n\n widgetRef.current = createChangelogWidget(workspaceSlug, {\n ...options,\n onOpenChange: onOpenChangeRef.current\n ? (isOpen: boolean) => onOpenChangeRef.current?.(isOpen)\n : undefined,\n });\n return widgetRef.current;\n }, [\n workspaceSlug,\n options.buttonSelector,\n options.position,\n options.theme,\n options.onLoad,\n ]);\n\n useEffect(() => {\n // Use requestAnimationFrame to ensure DOM is ready\n const frame = requestAnimationFrame(() => {\n const widget = initWidget();\n widgetRef.current = widget;\n });\n\n return () => {\n cancelAnimationFrame(frame);\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n };\n }, [initWidget]);\n\n return widgetRef.current;\n}\n\nexport function useWidget(options: {\n url: string;\n buttonSelector: string;\n position?: 'top' | 'bottom' | 'left' | 'right';\n onLoad?: () => void;\n onOpenChange?: (isOpen: boolean) => void;\n}): WidgetInstance | null {\n const widgetRef = useRef<WidgetInstance | null>(null);\n\n const initWidget = useCallback(() => {\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n\n const element = document.querySelector(options.buttonSelector);\n if (!element) {\n return null;\n }\n\n widgetRef.current = createWidget(options);\n return widgetRef.current;\n }, [options]);\n\n useEffect(() => {\n // Use requestAnimationFrame to ensure DOM is ready\n const frame = requestAnimationFrame(() => {\n const widget = initWidget();\n widgetRef.current = widget;\n });\n\n return () => {\n cancelAnimationFrame(frame);\n if (widgetRef.current) {\n widgetRef.current.destroy();\n }\n };\n }, [initWidget]);\n\n return widgetRef.current;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../src/index.ts", "../src/context.tsx", "../src/components/changelog-entry-modal.tsx", "../src/components/changelog-entries-list-dropdown.tsx", "../src/components/changelog-banner.tsx"],
|
|
4
|
+
"sourcesContent": ["// Export Provider and context hook\nexport {\n ChangelogProvider,\n useChangelogContext,\n type ChangelogProviderProps,\n} from './context';\n\n// Export React components\nexport {\n ChangelogEntryModal,\n type ChangelogEntryModalProps,\n} from './components/changelog-entry-modal';\n\nexport {\n ChangelogEntriesListDropdown,\n type ChangelogEntriesListDropdownProps,\n} from './components/changelog-entries-list-dropdown';\n\nexport {\n ChangelogBanner,\n type ChangelogBannerProps,\n} from './components/changelog-banner';\n\n// Export types\nexport type { ContentTheme } from './types';\n", "'use client';\n\nimport * as React from 'react';\nimport type { ContentTheme } from './types';\n\n// Lazy-loaded types - we don't import the actual module at the top level\ntype WidgetStore = {\n getState: () => Record<string, unknown>;\n mount: (source: string, widget: unknown) => Promise<void>;\n unmount: (source: string) => void;\n open: (source: string) => Promise<void>;\n setTheme: (theme: ContentTheme) => void;\n};\n\ntype WidgetModule = {\n createChangelogStore: () => WidgetStore;\n createChangelogEntryWidget: (\n ticketId: string,\n options: { base?: string; contentTheme?: ContentTheme; slug?: string }\n ) => unknown;\n createChangelogBannerWidget: (\n store: WidgetStore,\n options: { base?: string; contentTheme?: ContentTheme; slug: string; debug?: boolean }\n ) => Promise<unknown>;\n createChangelogEntriesListDropdownWidget: (\n anchor: string,\n store: WidgetStore,\n options: { base?: string; contentTheme?: ContentTheme; slug?: string; position?: 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw' | 'center' }\n ) => unknown;\n};\n\ntype ChangelogContextValue = {\n store: WidgetStore;\n module: WidgetModule;\n theme: ContentTheme;\n base?: string;\n slug: string;\n};\n\nconst ChangelogContext = React.createContext<ChangelogContextValue | null>(null);\n\nexport interface ChangelogProviderProps {\n children: React.ReactNode;\n slug: string;\n theme?: ContentTheme;\n base?: string;\n}\n\n/**\n * ChangelogProvider - Provides changelog store and configuration to child components\n *\n * This provider handles:\n * - Creating and managing the widget store (client-side only)\n * - Syncing theme changes to all widgets\n * - Providing base URL and slug to all child components\n */\nexport function ChangelogProvider({\n children,\n slug,\n theme = 'light',\n base,\n}: ChangelogProviderProps) {\n const [context, setContext] = React.useState<{\n store: WidgetStore;\n module: WidgetModule;\n } | null>(null);\n\n // Initialize store on client side only\n React.useEffect(() => {\n import('@squeletteapp/widget').then((mod) => {\n const widgetModule = mod as unknown as WidgetModule;\n setContext({\n store: widgetModule.createChangelogStore(),\n module: widgetModule,\n });\n });\n }, []);\n\n // Update theme when it changes\n React.useEffect(() => {\n context?.store.setTheme(theme);\n }, [context, theme]);\n\n // Don't render children until store is ready (client-side only)\n if (!context) {\n return null;\n }\n\n return (\n <ChangelogContext.Provider\n value={{ store: context.store, module: context.module, theme, base, slug }}\n >\n {children}\n </ChangelogContext.Provider>\n );\n}\n\nexport function useChangelogContext(): ChangelogContextValue {\n const context = React.useContext(ChangelogContext);\n if (!context) {\n throw new Error('useChangelogContext must be used within a ChangelogProvider');\n }\n return context;\n}\n", "'use client';\n\nimport * as React from 'react';\nimport { useChangelogContext } from '../context';\n\nexport interface ChangelogEntryModalProps {\n ticketId: string;\n onOpenChange?: (isOpen: boolean) => void;\n}\n\n/**\n * ChangelogEntryModal - Renders a modal for a single changelog entry\n *\n * This component manages its own widget lifecycle and automatically\n * cleans up on unmount. Must be used within a ChangelogProvider.\n */\nexport function ChangelogEntryModal({\n ticketId,\n onOpenChange,\n}: ChangelogEntryModalProps) {\n const { store, module, theme, base, slug } = useChangelogContext();\n const widgetRef = React.useRef<{ setTheme: (t: string) => void } | null>(null);\n\n React.useEffect(() => {\n const widget = module.createChangelogEntryWidget(ticketId, {\n base,\n contentTheme: theme,\n slug,\n }) as { onOpenChange: (cb: (isOpen: boolean) => void) => void; setTheme: (t: string) => void };\n\n if (onOpenChange) {\n widget.onOpenChange(onOpenChange);\n }\n\n widgetRef.current = widget;\n store.mount(ticketId, widget);\n\n return () => {\n store.unmount(ticketId);\n widgetRef.current = null;\n };\n }, [ticketId, slug, store, module, base, onOpenChange, theme]);\n\n // Update theme when it changes\n React.useEffect(() => {\n widgetRef.current?.setTheme(theme);\n }, [theme]);\n\n return null;\n}\n", "'use client';\n\nimport * as React from 'react';\nimport { useChangelogContext } from '../context';\n\ntype Position = 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw' | 'center';\n\nexport interface ChangelogEntriesListDropdownProps {\n children: React.ReactElement;\n position?: Position;\n}\n\n/**\n * ChangelogEntriesListDropdown - Renders a dropdown list of changelog entries\n *\n * This component wraps a child element (trigger) and opens the dropdown\n * when the child is clicked. Must be used within a ChangelogProvider.\n */\nexport function ChangelogEntriesListDropdown({\n children,\n position,\n}: ChangelogEntriesListDropdownProps) {\n const { store, module, theme, base, slug } = useChangelogContext();\n const widgetRef = React.useRef<{\n preload: () => void;\n open: () => void;\n destroy: () => void;\n setTheme: (t: string) => void;\n } | null>(null);\n const anchorId = React.useId();\n const cleanAnchorId = `sq-dropdown-${anchorId.replace(/:/g, '')}`;\n\n // Store initial theme in ref to use in creation\n const initialThemeRef = React.useRef(theme);\n\n // Create widget once on mount (theme changes handled separately via setTheme)\n React.useEffect(() => {\n const widget = module.createChangelogEntriesListDropdownWidget(\n `#${cleanAnchorId}`,\n store,\n {\n base,\n contentTheme: initialThemeRef.current,\n slug,\n position,\n }\n ) as {\n preload: () => void;\n open: () => void;\n destroy: () => void;\n setTheme: (t: string) => void;\n };\n\n widget.preload();\n widgetRef.current = widget;\n\n return () => {\n widget.destroy();\n widgetRef.current = null;\n };\n }, [slug, store, module, base, cleanAnchorId, position]);\n\n // Update theme when it changes (separate effect to avoid recreating widget)\n React.useEffect(() => {\n widgetRef.current?.setTheme(theme);\n }, [theme]);\n\n const handleClick = React.useCallback(() => {\n widgetRef.current?.open();\n }, []);\n\n // Clone the child and add the anchor id and click handler\n return React.cloneElement(children, {\n id: cleanAnchorId,\n onClick: (e: React.MouseEvent) => {\n const originalOnClick = children.props.onClick;\n if (originalOnClick) {\n originalOnClick(e);\n }\n handleClick();\n },\n });\n}\n", "'use client';\n\nimport * as React from 'react';\nimport { useChangelogContext } from '../context';\n\nexport interface ChangelogBannerProps {\n debug?: boolean;\n}\n\n/**\n * ChangelogBanner - Renders a banner for the latest changelog entry\n *\n * This component automatically fetches the latest changelog entry,\n * checks if it should be shown, and displays a banner at the bottom\n * of the screen. Must be used within a ChangelogProvider.\n */\nexport function ChangelogBanner({ debug = false }: ChangelogBannerProps) {\n const { store, module, theme, base, slug } = useChangelogContext();\n const widgetRef = React.useRef<{\n destroy: () => void;\n setTheme: (t: string) => void;\n } | null>(null);\n\n // Store initial theme in ref to use in creation\n const initialThemeRef = React.useRef(theme);\n\n // Create widget once on mount (theme changes handled separately via setTheme)\n React.useEffect(() => {\n let mounted = true;\n\n module\n .createChangelogBannerWidget(store, {\n base,\n contentTheme: initialThemeRef.current,\n slug,\n debug,\n })\n .then((widget) => {\n if (mounted && widget) {\n widgetRef.current = widget as {\n destroy: () => void;\n setTheme: (t: string) => void;\n };\n }\n });\n\n return () => {\n mounted = false;\n if (widgetRef.current) {\n widgetRef.current.destroy();\n widgetRef.current = null;\n }\n };\n }, [slug, store, module, base, debug]);\n\n // Update theme when it changes (separate effect to avoid recreating widget)\n React.useEffect(() => {\n widgetRef.current?.setTheme(theme);\n }, [theme]);\n\n return null;\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["React", "module", "React", "module", "React", "module"]
|
|
7
7
|
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ContentTheme = 'light' | 'dark';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squeletteapp/widget-react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
5
|
-
"description": "React components
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"description": "React components for Squelette changelog widgets",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react": ">=16.8.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@squeletteapp/widget": "
|
|
29
|
+
"@squeletteapp/widget": "1.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "^18.0.0",
|
|
@@ -37,9 +37,11 @@
|
|
|
37
37
|
"keywords": [
|
|
38
38
|
"react",
|
|
39
39
|
"widget",
|
|
40
|
-
"
|
|
40
|
+
"changelog",
|
|
41
41
|
"squelette"
|
|
42
42
|
],
|
|
43
43
|
"author": "Squelette",
|
|
44
|
-
"
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
45
47
|
}
|