@scalemule/news-publication 0.0.8 → 0.0.10
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/{chunk-PYCU2T5O.js → chunk-5QHNNRVQ.js} +1 -1
- package/dist/{chunk-R33MJWND.js → chunk-AYSBXLOT.js} +1 -1
- package/dist/{chunk-YQXS2KQI.js → chunk-C7ZPLH2K.js} +10 -1
- package/dist/chunk-NQD3M7ZY.js +283 -0
- package/dist/{chunk-TJ7RL3PV.js → chunk-RNXTBN5Z.js} +7 -0
- package/dist/cookie-consent-banner.js +2 -2
- package/dist/cookie-settings-view.cjs +7 -0
- package/dist/cookie-settings-view.js +2 -2
- package/dist/index.cjs +308 -0
- package/dist/index.d.cts +44 -2
- package/dist/index.d.ts +44 -2
- package/dist/index.js +5 -4
- package/dist/{marketplace-Ch7mdJZv.d.cts → marketplace-CpGWPbFk.d.cts} +20 -1
- package/dist/{marketplace-Ch7mdJZv.d.ts → marketplace-CpGWPbFk.d.ts} +20 -1
- package/dist/marketplace-forms.js +1 -1
- package/dist/marketplace-view.cjs +30 -3
- package/dist/marketplace-view.d.cts +3 -2
- package/dist/marketplace-view.d.ts +3 -2
- package/dist/marketplace-view.js +28 -4
- package/dist/theme-toggle.cjs +258 -0
- package/dist/theme-toggle.d.cts +22 -0
- package/dist/theme-toggle.d.ts +22 -0
- package/dist/theme-toggle.js +2 -0
- package/marketplace.css +2 -0
- package/package.json +7 -2
- package/tokens/broadsheet.css +177 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { hasConsented, COOKIE_CONSENT_EVENT, acceptAllCookies, recordConsentToCompliance, rejectOptionalCookies } from './chunk-
|
|
2
|
+
import { hasConsented, COOKIE_CONSENT_EVENT, acceptAllCookies, recordConsentToCompliance, rejectOptionalCookies } from './chunk-RNXTBN5Z.js';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getCookieConsent, DEFAULT_PREFERENCES_ACCEPTED, COOKIE_CATEGORIES, setCookieConsent, recordConsentToCompliance, DEFAULT_PREFERENCES_REJECTED } from './chunk-
|
|
2
|
+
import { getCookieConsent, DEFAULT_PREFERENCES_ACCEPTED, COOKIE_CATEGORIES, setCookieConsent, recordConsentToCompliance, DEFAULT_PREFERENCES_REJECTED } from './chunk-RNXTBN5Z.js';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -13,6 +13,15 @@ var CLASSIFIED_CATEGORIES = [
|
|
|
13
13
|
{ value: "community", label: "Community" },
|
|
14
14
|
{ value: "wanted", label: "Wanted" }
|
|
15
15
|
];
|
|
16
|
+
function dealsFeedPath() {
|
|
17
|
+
return "/v1/deals/feed";
|
|
18
|
+
}
|
|
19
|
+
function dealGoPath(offerId) {
|
|
20
|
+
return `/v1/deals/go/${encodeURIComponent(offerId)}`;
|
|
21
|
+
}
|
|
22
|
+
function dealDollars(cents) {
|
|
23
|
+
return cents != null ? `$${(cents / 100).toFixed(2)}` : null;
|
|
24
|
+
}
|
|
16
25
|
function clipChars(value, max) {
|
|
17
26
|
const chars = Array.from(value.trim());
|
|
18
27
|
return chars.length <= max ? chars.join("") : chars.slice(0, max).join("");
|
|
@@ -109,4 +118,4 @@ function prepareClassified(input, towns, region, now = /* @__PURE__ */ new Date(
|
|
|
109
118
|
};
|
|
110
119
|
}
|
|
111
120
|
|
|
112
|
-
export { CLASSIFIED_CATEGORIES, JOB_EMPLOYMENT_TYPES, categoryLabel, classifiedPath, classifiedSearchPath, clipChars, employmentLabel, isClassifiedCategory, isEmploymentType, jobEmployerBody, jobOpeningBody, jobPostingBody, prepareClassified, prepareJobPost, publicJobPath, publicJobsPath };
|
|
121
|
+
export { CLASSIFIED_CATEGORIES, JOB_EMPLOYMENT_TYPES, categoryLabel, classifiedPath, classifiedSearchPath, clipChars, dealDollars, dealGoPath, dealsFeedPath, employmentLabel, isClassifiedCategory, isEmploymentType, jobEmployerBody, jobOpeningBody, jobPostingBody, prepareClassified, prepareJobPost, publicJobPath, publicJobsPath };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore, useState, useEffect } from 'react';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/theme-toggle.tsx
|
|
6
|
+
|
|
7
|
+
// src/theme.ts
|
|
8
|
+
var THEME_COOKIE = "news_publication_theme";
|
|
9
|
+
var THEME_STORAGE_KEY = "news_publication_theme";
|
|
10
|
+
var THEME_EVENT = "news_publication_theme_change";
|
|
11
|
+
var THEME_MAX_AGE_SECONDS = 365 * 24 * 60 * 60;
|
|
12
|
+
var memoryTheme = "system";
|
|
13
|
+
function getSystemTheme() {
|
|
14
|
+
if (typeof window === "undefined" || !window.matchMedia) return "light";
|
|
15
|
+
try {
|
|
16
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
17
|
+
} catch {
|
|
18
|
+
return "light";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function resolveEffectiveTheme(mode) {
|
|
22
|
+
if (mode === "system") return getSystemTheme();
|
|
23
|
+
return mode;
|
|
24
|
+
}
|
|
25
|
+
function getStoredTheme() {
|
|
26
|
+
if (typeof window === "undefined") return memoryTheme;
|
|
27
|
+
try {
|
|
28
|
+
const stored = window.localStorage?.getItem?.(THEME_STORAGE_KEY);
|
|
29
|
+
if (stored === "light" || stored === "dark" || stored === "system") {
|
|
30
|
+
memoryTheme = stored;
|
|
31
|
+
return stored;
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
if (typeof document !== "undefined" && document.cookie) {
|
|
36
|
+
try {
|
|
37
|
+
const match = document.cookie.match(new RegExp(`(?:^|; )${THEME_COOKIE}=([^;]*)`));
|
|
38
|
+
if (match) {
|
|
39
|
+
const decoded = decodeURIComponent(match[1]);
|
|
40
|
+
if (decoded === "light" || decoded === "dark" || decoded === "system") {
|
|
41
|
+
memoryTheme = decoded;
|
|
42
|
+
return decoded;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return memoryTheme;
|
|
49
|
+
}
|
|
50
|
+
function applyTheme(mode) {
|
|
51
|
+
if (typeof document === "undefined") return;
|
|
52
|
+
try {
|
|
53
|
+
document.documentElement.setAttribute("data-theme", mode);
|
|
54
|
+
const elements = document.querySelectorAll(".publication");
|
|
55
|
+
elements.forEach((el) => el.setAttribute("data-theme", mode));
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
var memoryListeners = /* @__PURE__ */ new Set();
|
|
60
|
+
function setTheme(mode) {
|
|
61
|
+
memoryTheme = mode;
|
|
62
|
+
if (typeof window !== "undefined") {
|
|
63
|
+
try {
|
|
64
|
+
window.localStorage?.setItem?.(THEME_STORAGE_KEY, mode);
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
if (typeof document !== "undefined") {
|
|
68
|
+
try {
|
|
69
|
+
document.cookie = `${THEME_COOKIE}=${encodeURIComponent(mode)}; path=/; max-age=${THEME_MAX_AGE_SECONDS}; SameSite=Lax`;
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
applyTheme(mode);
|
|
74
|
+
const effective = resolveEffectiveTheme(mode);
|
|
75
|
+
try {
|
|
76
|
+
window.dispatchEvent(
|
|
77
|
+
new CustomEvent(THEME_EVENT, {
|
|
78
|
+
detail: { mode, effective }
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
} catch {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
memoryListeners.forEach((listener) => {
|
|
85
|
+
try {
|
|
86
|
+
listener();
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function clearTheme() {
|
|
92
|
+
memoryTheme = "system";
|
|
93
|
+
if (typeof document !== "undefined") {
|
|
94
|
+
try {
|
|
95
|
+
document.cookie = `${THEME_COOKIE}=; path=/; max-age=0; SameSite=Lax`;
|
|
96
|
+
document.documentElement.removeAttribute("data-theme");
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (typeof window !== "undefined") {
|
|
101
|
+
try {
|
|
102
|
+
window.localStorage?.removeItem?.(THEME_STORAGE_KEY);
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
memoryListeners.forEach((listener) => {
|
|
107
|
+
try {
|
|
108
|
+
listener();
|
|
109
|
+
} catch {
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function subscribeTheme(listener) {
|
|
114
|
+
memoryListeners.add(listener);
|
|
115
|
+
if (typeof window === "undefined") {
|
|
116
|
+
return () => {
|
|
117
|
+
memoryListeners.delete(listener);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const onStorage = (e) => {
|
|
121
|
+
if (e.key === THEME_STORAGE_KEY) {
|
|
122
|
+
applyTheme(getStoredTheme());
|
|
123
|
+
listener();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const onCustom = () => {
|
|
127
|
+
listener();
|
|
128
|
+
};
|
|
129
|
+
window.addEventListener("storage", onStorage);
|
|
130
|
+
window.addEventListener(THEME_EVENT, onCustom);
|
|
131
|
+
let mediaQuery;
|
|
132
|
+
let onMediaChange;
|
|
133
|
+
if (window.matchMedia) {
|
|
134
|
+
try {
|
|
135
|
+
mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
136
|
+
onMediaChange = () => {
|
|
137
|
+
if (getStoredTheme() === "system") {
|
|
138
|
+
applyTheme("system");
|
|
139
|
+
listener();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
if (mediaQuery.addEventListener) {
|
|
143
|
+
mediaQuery.addEventListener("change", onMediaChange);
|
|
144
|
+
} else if (mediaQuery.addListener) {
|
|
145
|
+
mediaQuery.addListener(onMediaChange);
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return () => {
|
|
151
|
+
window.removeEventListener("storage", onStorage);
|
|
152
|
+
window.removeEventListener(THEME_EVENT, onCustom);
|
|
153
|
+
if (mediaQuery && onMediaChange) {
|
|
154
|
+
if (mediaQuery.removeEventListener) {
|
|
155
|
+
mediaQuery.removeEventListener("change", onMediaChange);
|
|
156
|
+
} else if (mediaQuery.removeListener) {
|
|
157
|
+
mediaQuery.removeListener(onMediaChange);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function themeInitScript() {
|
|
163
|
+
return `(function(){try{var k='${THEME_STORAGE_KEY}',m=localStorage.getItem(k);if(!m){var c=document.cookie.match(/(?:^|; )news_publication_theme=([^;]*)/);m=c?decodeURIComponent(c[1]):'system';}if(m==='light'||m==='dark'||m==='system'){document.documentElement.setAttribute('data-theme',m);}}catch(e){}})();`;
|
|
164
|
+
}
|
|
165
|
+
function SunIcon() {
|
|
166
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
167
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }),
|
|
168
|
+
/* @__PURE__ */ jsx("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
|
|
169
|
+
] });
|
|
170
|
+
}
|
|
171
|
+
function MoonIcon() {
|
|
172
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
|
|
173
|
+
}
|
|
174
|
+
function SystemIcon() {
|
|
175
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
176
|
+
/* @__PURE__ */ jsx("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
|
|
177
|
+
/* @__PURE__ */ jsx("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
|
|
178
|
+
/* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
|
|
179
|
+
] });
|
|
180
|
+
}
|
|
181
|
+
function ThemeToggle({
|
|
182
|
+
variant = "compact",
|
|
183
|
+
className = "",
|
|
184
|
+
showPromotion = false,
|
|
185
|
+
accountUrl = "/account"
|
|
186
|
+
}) {
|
|
187
|
+
const currentTheme = useSyncExternalStore(subscribeTheme, getStoredTheme, () => "system");
|
|
188
|
+
const [mounted, setMounted] = useState(false);
|
|
189
|
+
const [promoVisible, setPromoVisible] = useState(false);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
setMounted(true);
|
|
192
|
+
}, []);
|
|
193
|
+
const handleSelect = (mode) => {
|
|
194
|
+
setTheme(mode);
|
|
195
|
+
if (showPromotion) {
|
|
196
|
+
setPromoVisible(true);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const active = mounted ? currentTheme : "system";
|
|
200
|
+
return /* @__PURE__ */ jsxs("div", { className: `pub-theme-toggle-container ${className}`.trim(), children: [
|
|
201
|
+
/* @__PURE__ */ jsxs(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
className: "pub-theme-toggle",
|
|
205
|
+
"data-variant": variant,
|
|
206
|
+
role: "group",
|
|
207
|
+
"aria-label": "Display theme selection",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsxs(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
type: "button",
|
|
213
|
+
onClick: () => handleSelect("light"),
|
|
214
|
+
"aria-pressed": active === "light",
|
|
215
|
+
"data-active": active === "light",
|
|
216
|
+
title: "Light theme (broadsheet day edition)",
|
|
217
|
+
"aria-label": "Light theme",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ jsx(SunIcon, {}),
|
|
220
|
+
variant !== "compact" && /* @__PURE__ */ jsx("span", { children: "Light" })
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ jsxs(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
type: "button",
|
|
228
|
+
onClick: () => handleSelect("dark"),
|
|
229
|
+
"aria-pressed": active === "dark",
|
|
230
|
+
"data-active": active === "dark",
|
|
231
|
+
title: "Dark theme (broadsheet evening edition)",
|
|
232
|
+
"aria-label": "Dark theme",
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(MoonIcon, {}),
|
|
235
|
+
variant !== "compact" && /* @__PURE__ */ jsx("span", { children: "Dark" })
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ jsxs(
|
|
240
|
+
"button",
|
|
241
|
+
{
|
|
242
|
+
type: "button",
|
|
243
|
+
onClick: () => handleSelect("system"),
|
|
244
|
+
"aria-pressed": active === "system",
|
|
245
|
+
"data-active": active === "system",
|
|
246
|
+
title: "System preference (matches device setting)",
|
|
247
|
+
"aria-label": "System theme",
|
|
248
|
+
children: [
|
|
249
|
+
/* @__PURE__ */ jsx(SystemIcon, {}),
|
|
250
|
+
variant !== "compact" && /* @__PURE__ */ jsx("span", { children: "System" })
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
promoVisible && /* @__PURE__ */ jsxs("div", { className: "pub-theme-promo", role: "status", children: [
|
|
258
|
+
/* @__PURE__ */ jsx("span", { children: "Theme saved for this browser. " }),
|
|
259
|
+
/* @__PURE__ */ jsx("a", { href: accountUrl, children: "Create a free reader account" }),
|
|
260
|
+
/* @__PURE__ */ jsx("span", { children: " to sync preferences across all your devices." }),
|
|
261
|
+
/* @__PURE__ */ jsx(
|
|
262
|
+
"button",
|
|
263
|
+
{
|
|
264
|
+
type: "button",
|
|
265
|
+
onClick: () => setPromoVisible(false),
|
|
266
|
+
"aria-label": "Dismiss note",
|
|
267
|
+
style: {
|
|
268
|
+
marginLeft: "8px",
|
|
269
|
+
background: "none",
|
|
270
|
+
border: "none",
|
|
271
|
+
cursor: "pointer",
|
|
272
|
+
color: "var(--pub-muted)",
|
|
273
|
+
fontSize: "12px",
|
|
274
|
+
padding: "0 4px"
|
|
275
|
+
},
|
|
276
|
+
children: "\xD7"
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] })
|
|
280
|
+
] });
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export { THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, ThemeToggle, applyTheme, clearTheme, getStoredTheme, getSystemTheme, resolveEffectiveTheme, setTheme, subscribeTheme, themeInitScript };
|
|
@@ -83,6 +83,13 @@ var COOKIE_CATEGORIES = [
|
|
|
83
83
|
duration: "1 year",
|
|
84
84
|
type: "Local Storage"
|
|
85
85
|
},
|
|
86
|
+
{
|
|
87
|
+
name: "news_publication_theme",
|
|
88
|
+
provider: "First-Party",
|
|
89
|
+
purpose: "Remembers your reading theme preference (light, dark, or system).",
|
|
90
|
+
duration: "1 year",
|
|
91
|
+
type: "HTTP Cookie"
|
|
92
|
+
},
|
|
86
93
|
{
|
|
87
94
|
name: "audio_narration_speed",
|
|
88
95
|
provider: "First-Party",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CookieConsentBanner } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { CookieConsentBanner } from './chunk-5QHNNRVQ.js';
|
|
3
|
+
import './chunk-RNXTBN5Z.js';
|
|
@@ -89,6 +89,13 @@ var COOKIE_CATEGORIES = [
|
|
|
89
89
|
duration: "1 year",
|
|
90
90
|
type: "Local Storage"
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
name: "news_publication_theme",
|
|
94
|
+
provider: "First-Party",
|
|
95
|
+
purpose: "Remembers your reading theme preference (light, dark, or system).",
|
|
96
|
+
duration: "1 year",
|
|
97
|
+
type: "HTTP Cookie"
|
|
98
|
+
},
|
|
92
99
|
{
|
|
93
100
|
name: "audio_narration_speed",
|
|
94
101
|
provider: "First-Party",
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CookieSettingsView } from './chunk-
|
|
3
|
-
import './chunk-
|
|
2
|
+
export { CookieSettingsView } from './chunk-AYSBXLOT.js';
|
|
3
|
+
import './chunk-RNXTBN5Z.js';
|