@kolkrabbi/kol-component 0.308.0 → 0.310.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/package.json +2 -2
- package/src/atoms/Avatar.jsx +3 -1
- package/src/index.js +2 -0
- package/src/molecules/KindPreview.jsx +11 -6
- package/src/molecules/Modal.jsx +64 -6
- package/src/molecules/PdfPage.jsx +9 -7
- package/src/organisms/MediaLibraryPages.jsx +3 -0
- package/src/utilities/credentials.js +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.310.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
41
|
+
"@kolkrabbi/kol-icons": "^0.52.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"src",
|
package/src/atoms/Avatar.jsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
|
|
3
3
|
const SIZE_MAP = {
|
|
4
|
+
/* xs — a rail glyph's 20 (HubAccountRow, kol-fxr 2026-10-28: the signed-in row draws the user where the glyph sits) */
|
|
5
|
+
xs: 'w-5 h-5 kol-helper-10',
|
|
4
6
|
sm: 'w-8 h-8 kol-helper-12',
|
|
5
7
|
md: 'w-10 h-10 kol-helper-14',
|
|
6
8
|
lg: 'w-14 h-14 kol-helper-16',
|
|
@@ -21,7 +23,7 @@ const SIZE_MAP = {
|
|
|
21
23
|
* @param {string} [src] resolved image src — the consumer resolves it, this
|
|
22
24
|
* atom never builds a URL
|
|
23
25
|
* @param {string} [alt=''] photo alt text
|
|
24
|
-
* @param {'sm'|'md'|'lg'|'xl'} [size='sm']
|
|
26
|
+
* @param {'xs'|'sm'|'md'|'lg'|'xl'} [size='sm'] `xs` is 20, a rail row's glyph
|
|
25
27
|
*/
|
|
26
28
|
export default function Avatar({ initial, src, alt = '', size = 'sm', className = '' }) {
|
|
27
29
|
const sizeCls = SIZE_MAP[size] ?? SIZE_MAP.sm
|
package/src/index.js
CHANGED
|
@@ -39,6 +39,8 @@ export { default as IconPlate, KeylineGuide } from './atoms/IconPlate.jsx'
|
|
|
39
39
|
export { default as IconToggle } from './atoms/IconToggle.jsx'
|
|
40
40
|
export { default as ExitPreview } from './utilities/ExitPreview.jsx'
|
|
41
41
|
export { default as Figure } from './atoms/Figure.jsx'
|
|
42
|
+
/* which file origins a preview fetches with the sign-in cookie (Quick Look on private files, 2026-10-28) */
|
|
43
|
+
export { registerCredentialedOrigin, credentialsFor } from './utilities/credentials.js'
|
|
42
44
|
export { default as FullscreenOverlay } from './utilities/FullscreenOverlay.jsx'
|
|
43
45
|
/* the overlay layer stack — which open layer owns Escape; exported so a layer in another package
|
|
44
46
|
* (kol-shell's walkthrough) joins the same stack instead of a second one (2026-10-09) */
|
|
@@ -9,6 +9,7 @@ import { kindOf as defaultKindOf, extOf as defaultExtOf, KIND_LABEL } from '../u
|
|
|
9
9
|
import markdownToHtml from '../utilities/markdownToHtml.js'
|
|
10
10
|
import { parseFrontmatter } from '@kolkrabbi/kol-markdown'
|
|
11
11
|
import DocPage from './DocPage.jsx'
|
|
12
|
+
import { credentialsFor } from '../utilities/credentials.js'
|
|
12
13
|
|
|
13
14
|
/* taxonomy-ok: molecule — nests the DS media atoms + CodeBlock (relative). */
|
|
14
15
|
|
|
@@ -51,13 +52,14 @@ const LANG = {
|
|
|
51
52
|
csv: 'text', tsv: 'text', pgn: 'text', txt: 'text', xml: 'xml',
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
function useTextContent(url, enabled, limit) {
|
|
55
|
+
function useTextContent(url, enabled, limit, credentials) {
|
|
55
56
|
const [result, setResult] = useState({ url: null, text: '', error: null, truncated: false })
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
if (!enabled || !url) return undefined
|
|
58
59
|
let cancelled = false
|
|
59
60
|
const controller = new AbortController()
|
|
60
|
-
|
|
61
|
+
/* the sign-in cookie for a registered origin (utilities/credentials.js) */
|
|
62
|
+
fetch(url, { signal: controller.signal, credentials: credentialsFor(url, credentials) })
|
|
61
63
|
.then(async (res) => {
|
|
62
64
|
if (!res.ok) throw new Error(`${res.status}`)
|
|
63
65
|
const size = Number(res.headers.get('content-length') || 0)
|
|
@@ -68,7 +70,7 @@ function useTextContent(url, enabled, limit) {
|
|
|
68
70
|
})
|
|
69
71
|
.catch((e) => { if (!cancelled && e.name !== 'AbortError') setResult({ url, text: '', error: e.message, truncated: false }) })
|
|
70
72
|
return () => { cancelled = true; controller.abort() }
|
|
71
|
-
}, [url, enabled, limit])
|
|
73
|
+
}, [url, enabled, limit, credentials])
|
|
72
74
|
return { ...result, loading: enabled && result.url !== url }
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -116,6 +118,9 @@ const PDF_LIMIT = 8 * 1024 * 1024
|
|
|
116
118
|
export default function KindPreview({
|
|
117
119
|
o, text: textProp, kind: kindProp, urlOf = (x) => x.url, poster, kindOf = defaultKindOf,
|
|
118
120
|
extOf = defaultExtOf, kindLabel = KIND_LABEL, textLimit = TEXT_LIMIT,
|
|
121
|
+
/* `'include'` sends the sign-in cookie with this preview's own fetches (PDF, text); unset, a registered origin decides
|
|
122
|
+
* (`registerCredentialedOrigin`, utilities/credentials.js) */
|
|
123
|
+
credentials,
|
|
119
124
|
/* ONE RENDERER, THREE FITS (user 2026-09-23: *"theres just a bunch of different views, why? you
|
|
120
125
|
* know what consistency means?"*). Five surfaces each patched this component with their own CSS
|
|
121
126
|
* or bypassed it — the pane, the wall tile, the row thumb, the kind overview and the overlay. The
|
|
@@ -153,7 +158,7 @@ export default function KindPreview({
|
|
|
153
158
|
const ext = extOf(o.key)
|
|
154
159
|
const name = o.displayKey ?? o.key
|
|
155
160
|
const isText = kind === 'text' || kind === 'code' || kind === 'markdown' || kind === 'json' || kind === 'yaml'
|
|
156
|
-
const fetched = useTextContent(url, isText && textProp == null, textLimit)
|
|
161
|
+
const fetched = useTextContent(url, isText && textProp == null, textLimit, credentials)
|
|
157
162
|
/* content in hand is never loading and never errors — there is nothing to
|
|
158
163
|
* wait for. It still honours `textLimit`, so one long note cannot outgrow a
|
|
159
164
|
* tile the way a fetched one cannot. */
|
|
@@ -215,9 +220,9 @@ export default function KindPreview({
|
|
|
215
220
|
* pulled to paint one page. */
|
|
216
221
|
const servableUrl = /^(https?:|data:|blob:|\/)/.test(String(url ?? ''))
|
|
217
222
|
if (ext === 'pdf' && servableUrl && fit !== 'thumb' && (o.size ?? 0) <= pdfLimit) {
|
|
218
|
-
if (fit === 'sheet') return <PdfDocument src={url} fallback={icon} />
|
|
223
|
+
if (fit === 'sheet') return <PdfDocument src={url} fallback={icon} credentials={credentials} />
|
|
219
224
|
return (
|
|
220
|
-
<PdfPage src={url} fallback={icon}
|
|
225
|
+
<PdfPage src={url} fallback={icon} credentials={credentials}
|
|
221
226
|
className={fit === 'tile' ? 'w-full h-full object-cover object-top' : 'w-full h-auto rounded'} />
|
|
222
227
|
)
|
|
223
228
|
}
|
package/src/molecules/Modal.jsx
CHANGED
|
@@ -23,6 +23,15 @@ import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
|
23
23
|
* masks the field (`autoComplete="current-password"`) for the family's sign-in prompts. The
|
|
24
24
|
* native fallback cannot mask — mount a ModalProvider. `placeholder` sits in the same options.
|
|
25
25
|
*
|
|
26
|
+
* FORM (HubAccountRow, kol-fxr 2026-10-28 — sign-in asks Email AND Password): `form(title, fields, { okLabel, cancelLabel })`
|
|
27
|
+
* draws one field per `{ id, placeholder, type?, autoComplete?, defaultValue? }` and resolves `{ [id]: value }` on submit,
|
|
28
|
+
* `null` on cancel. The first field takes the focus; Enter in any field submits.
|
|
29
|
+
*
|
|
30
|
+
* THE PAGE HOLDS STILL UNDER THE KEYBOARD (PromptHoldsWithKeyboard, kol-fxr 2026-10-28 — user: *"does the UI have to move
|
|
31
|
+
* upp to show keyboard?"*): every dialog sits in the VISUAL viewport (`visualViewport` resize/scroll), so on an iPhone it
|
|
32
|
+
* rides above the keyboard; a field takes its focus without scrolling (`preventScroll`), and the document's scroll is put
|
|
33
|
+
* back when the keyboard closes and when the dialog does.
|
|
34
|
+
*
|
|
26
35
|
* KEYBOARD: the dialog opens focused (prompt → its field, confirm/alert → OK), Tab cycles inside
|
|
27
36
|
* it, and Enter on a focused button presses that button rather than submitting.
|
|
28
37
|
*
|
|
@@ -77,8 +86,12 @@ export function ModalProvider({ children }) {
|
|
|
77
86
|
new Promise((resolve) => setState({ kind: 'alert', title, okLabel, resolve })),
|
|
78
87
|
[])
|
|
79
88
|
|
|
89
|
+
const form = useCallback((title, fields = [], { okLabel, cancelLabel } = {}) =>
|
|
90
|
+
new Promise((resolve) => setState({ kind: 'form', title, fields, okLabel, cancelLabel, resolve })),
|
|
91
|
+
[])
|
|
92
|
+
|
|
80
93
|
return (
|
|
81
|
-
<ModalCtx.Provider value={{ prompt, confirm, alert }}>
|
|
94
|
+
<ModalCtx.Provider value={{ prompt, confirm, alert, form }}>
|
|
82
95
|
{children}
|
|
83
96
|
{state && typeof document !== 'undefined' && createPortal(
|
|
84
97
|
<ModalView state={state} closeWith={closeWith} />,
|
|
@@ -91,18 +104,47 @@ export function ModalProvider({ children }) {
|
|
|
91
104
|
function ModalView({ state, closeWith }) {
|
|
92
105
|
const [val, setVal] = useState(state.defaultValue ?? '')
|
|
93
106
|
const [values, setValues] = useState(() => Object.fromEntries((state.options ?? []).map((o) => [o.id, !!o.defaultValue])))
|
|
107
|
+
const [fieldVals, setFieldVals] = useState(() => Object.fromEntries((state.fields ?? []).map((f) => [f.id, f.defaultValue ?? ''])))
|
|
94
108
|
const inputRef = useRef(null)
|
|
95
109
|
const dialogRef = useRef(null)
|
|
110
|
+
const overlayRef = useRef(null)
|
|
111
|
+
const typing = state.kind === 'prompt' || state.kind === 'form'
|
|
112
|
+
|
|
113
|
+
/* the visual viewport (PromptHoldsWithKeyboard): the scrim is sized to it, so the dialog centres above the keyboard
|
|
114
|
+
* instead of the browser scrolling the page to clear it; the scroll the page had is restored when the keyboard goes
|
|
115
|
+
* (the visual viewport back to full height) and when the dialog closes */
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (typeof window === 'undefined') return undefined
|
|
118
|
+
const y0 = window.scrollY
|
|
119
|
+
const vv = window.visualViewport
|
|
120
|
+
const fit = () => {
|
|
121
|
+
const el = overlayRef.current
|
|
122
|
+
if (!vv || !el) return
|
|
123
|
+
el.style.top = `${vv.offsetTop}px`
|
|
124
|
+
el.style.left = `${vv.offsetLeft}px`
|
|
125
|
+
el.style.width = `${vv.width}px`
|
|
126
|
+
el.style.height = `${vv.height}px`
|
|
127
|
+
if (vv.height >= window.innerHeight - 1 && window.scrollY !== y0) window.scrollTo(0, y0)
|
|
128
|
+
}
|
|
129
|
+
fit()
|
|
130
|
+
vv?.addEventListener('resize', fit)
|
|
131
|
+
vv?.addEventListener('scroll', fit)
|
|
132
|
+
return () => {
|
|
133
|
+
vv?.removeEventListener('resize', fit)
|
|
134
|
+
vv?.removeEventListener('scroll', fit)
|
|
135
|
+
if (window.scrollY !== y0) window.scrollTo(0, y0)
|
|
136
|
+
}
|
|
137
|
+
}, [])
|
|
96
138
|
|
|
97
139
|
/* alert resolves `undefined` whichever way it is dismissed; a confirm with toggles resolves
|
|
98
140
|
* `{ ok, values }` */
|
|
99
141
|
const answer = (ok) => (state.options ? { ok, values } : ok)
|
|
100
|
-
const submit = () => closeWith(state.kind === 'prompt' ? val : state.kind === 'alert' ? undefined : answer(true))
|
|
101
|
-
const cancel = () => closeWith(
|
|
142
|
+
const submit = () => closeWith(state.kind === 'prompt' ? val : state.kind === 'form' ? fieldVals : state.kind === 'alert' ? undefined : answer(true))
|
|
143
|
+
const cancel = () => closeWith(typing ? null : state.kind === 'alert' ? undefined : answer(false))
|
|
102
144
|
|
|
103
145
|
/* focus once on open — the key effect below re-runs per keystroke and would steal it back */
|
|
104
146
|
useEffect(() => {
|
|
105
|
-
if (
|
|
147
|
+
if (typing) inputRef.current?.focus({ preventScroll: true })
|
|
106
148
|
else dialogRef.current?.querySelector('[data-modal-ok]')?.focus()
|
|
107
149
|
}, [state.kind])
|
|
108
150
|
|
|
@@ -121,10 +163,11 @@ function ModalView({ state, closeWith }) {
|
|
|
121
163
|
}
|
|
122
164
|
window.addEventListener('keydown', onKey)
|
|
123
165
|
return () => window.removeEventListener('keydown', onKey)
|
|
124
|
-
}, [state.kind, val, values, closeWith]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
166
|
+
}, [state.kind, val, values, fieldVals, closeWith]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
125
167
|
|
|
126
168
|
return (
|
|
127
169
|
<div
|
|
170
|
+
ref={overlayRef}
|
|
128
171
|
onMouseDown={cancel}
|
|
129
172
|
/* THE scrim (overlay-scrim-outliers sweep, 2026-09-03): the docs said Modal
|
|
130
173
|
wore `.kol-overlay-scrim`; the source drew a raw `rgba(0,0,0,0.5)`. The
|
|
@@ -137,7 +180,7 @@ function ModalView({ state, closeWith }) {
|
|
|
137
180
|
>
|
|
138
181
|
<div
|
|
139
182
|
ref={dialogRef}
|
|
140
|
-
role={
|
|
183
|
+
role={typing ? 'dialog' : 'alertdialog'}
|
|
141
184
|
aria-modal="true"
|
|
142
185
|
aria-labelledby="kol-modal-title"
|
|
143
186
|
onMouseDown={(e) => e.stopPropagation()}
|
|
@@ -166,6 +209,21 @@ function ModalView({ state, closeWith }) {
|
|
|
166
209
|
className="w-full"
|
|
167
210
|
/>
|
|
168
211
|
)}
|
|
212
|
+
{state.kind === 'form' && state.fields.map((f, i) => (
|
|
213
|
+
<Input
|
|
214
|
+
key={f.id}
|
|
215
|
+
ref={i === 0 ? inputRef : undefined}
|
|
216
|
+
type={f.type ?? 'text'}
|
|
217
|
+
autoComplete={f.autoComplete}
|
|
218
|
+
placeholder={f.placeholder}
|
|
219
|
+
aria-label={f.placeholder ?? f.id}
|
|
220
|
+
variant="outline"
|
|
221
|
+
size="sm"
|
|
222
|
+
value={fieldVals[f.id]}
|
|
223
|
+
onChange={(e) => setFieldVals((v) => ({ ...v, [f.id]: e.target.value }))}
|
|
224
|
+
className="w-full"
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
169
227
|
{state.options && (
|
|
170
228
|
<div className="flex flex-col gap-3">
|
|
171
229
|
{state.options.map((o) => (
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { credentialsFor } from '../utilities/credentials.js'
|
|
1
2
|
import { useEffect, useRef, useState } from 'react'
|
|
2
3
|
|
|
3
4
|
/* taxonomy-ok: molecule — a renderer KindPreview composes; no DS parts of its own to nest. */
|
|
@@ -29,17 +30,18 @@ async function loadPdfjs() {
|
|
|
29
30
|
return lib
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
function usePdf(src) {
|
|
33
|
+
function usePdf(src, credentials) {
|
|
33
34
|
const [state, setState] = useState({ src: null, doc: null, failed: false })
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
let cancelled = false
|
|
36
37
|
let loading = null
|
|
37
38
|
loadPdfjs()
|
|
38
|
-
|
|
39
|
+
/* the sign-in cookie for a registered origin (utilities/credentials.js) — a private file answers 401 without it */
|
|
40
|
+
.then((lib) => { loading = lib.getDocument({ url: src, withCredentials: credentialsFor(src, credentials) === 'include' }); return loading.promise })
|
|
39
41
|
.then((doc) => { if (!cancelled) setState({ src, doc, failed: false }) })
|
|
40
42
|
.catch(() => { if (!cancelled) setState({ src, doc: null, failed: true }) })
|
|
41
43
|
return () => { cancelled = true; loading?.destroy() }
|
|
42
|
-
}, [src])
|
|
44
|
+
}, [src, credentials])
|
|
43
45
|
return state.src === src ? state : { doc: null, failed: false }
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -68,14 +70,14 @@ function PdfCanvas({ doc, page, className = '' }) {
|
|
|
68
70
|
return <canvas ref={ref} className={`kol-pdf-page ${className}`.trim()} />
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
export default function PdfPage({ src, fallback = null, className = '' }) {
|
|
72
|
-
const { doc, failed } = usePdf(src)
|
|
73
|
+
export default function PdfPage({ src, fallback = null, className = '', credentials }) {
|
|
74
|
+
const { doc, failed } = usePdf(src, credentials)
|
|
73
75
|
if (failed) return fallback
|
|
74
76
|
return <PdfCanvas doc={doc} page={1} className={className} />
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
export function PdfDocument({ src, fallback = null }) {
|
|
78
|
-
const { doc, failed } = usePdf(src)
|
|
79
|
+
export function PdfDocument({ src, fallback = null, credentials }) {
|
|
80
|
+
const { doc, failed } = usePdf(src, credentials)
|
|
79
81
|
const [current, setCurrent] = useState(1)
|
|
80
82
|
const mainRef = useRef(null)
|
|
81
83
|
const pages = doc ? Array.from({ length: doc.numPages }, (_, i) => i + 1) : []
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment, createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
import { registerCredentialedOrigin } from '../utilities/credentials.js'
|
|
2
3
|
import formatSize from '../utilities/formatSize.js'
|
|
3
4
|
import { ROW_HEIGHT, ROW_FILL } from '../molecules/OptionRow.jsx'
|
|
4
5
|
import { glyphSize } from '../hooks/glyphLadders.js'
|
|
@@ -190,6 +191,8 @@ function useBucketLibrary({ client, bucket, defaults, settings: controlled, onSe
|
|
|
190
191
|
const buckets = useMemo(() => client?.buckets?.() ?? [], [client])
|
|
191
192
|
const bucketMeta = buckets.find((b) => b.id === bucket) ?? buckets[0] ?? { id: null, label: '', writable: false }
|
|
192
193
|
const bucketId = bucketMeta.id
|
|
194
|
+
/* a signed-in bucket's files are fetched with the cookie by every preview (utilities/credentials.js, 2026-10-28) */
|
|
195
|
+
if (bucketMeta.signedIn && bucketMeta.publicBase) registerCredentialedOrigin(bucketMeta.publicBase)
|
|
193
196
|
const base = () => ({ ...SETTINGS_BASE, ...(defaults?.[bucketId] ?? defaults ?? {}) })
|
|
194
197
|
const [own, setOwn] = useState(base)
|
|
195
198
|
/* PERSONALISATION (the media D1 pass, 2026-09-25): an uncontrolled page whose client offers
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* credentials — which file URLs a preview fetches WITH the sign-in cookie (ArticleRendererHomeHeroSelection, kol-website
|
|
3
|
+
* 2026-10-28 — a PDF on private.kolkrabbi.io answered 401 in Quick Look: `PdfPage` and `KindPreview` fetch the file
|
|
4
|
+
* themselves, and a plain fetch sends no cookie, while an <img> or a download does).
|
|
5
|
+
*
|
|
6
|
+
* A REGISTRY OF ORIGINS, not "every cross-origin URL": a credentialed request to a public CDN that answers
|
|
7
|
+
* `Access-Control-Allow-Origin: *` is refused by the browser, so sending the cookie everywhere would break every public
|
|
8
|
+
* file. An origin is registered by whoever knows it is signed in — `MediaLibrary` registers its signed-in bucket's
|
|
9
|
+
* `publicBase` (kol-media-client marks the private bucket `signedIn`), an app registers its own once at boot. A
|
|
10
|
+
* `credentials` prop on `KindPreview` / `PdfPage` overrides per call.
|
|
11
|
+
*
|
|
12
|
+
* import { registerCredentialedOrigin } from '@kolkrabbi/kol-component'
|
|
13
|
+
* registerCredentialedOrigin('https://private.kolkrabbi.io')
|
|
14
|
+
*/
|
|
15
|
+
const ORIGINS = new Set()
|
|
16
|
+
|
|
17
|
+
const originOf = (url) => {
|
|
18
|
+
try { return new URL(url, typeof location !== 'undefined' ? location.href : 'http://localhost').origin } catch { return null }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function registerCredentialedOrigin(url) {
|
|
22
|
+
const o = originOf(url)
|
|
23
|
+
if (o) ORIGINS.add(o)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* 'include' for a registered origin, else undefined (the browser's same-origin default) */
|
|
27
|
+
export function credentialsFor(url, override) {
|
|
28
|
+
if (override) return override
|
|
29
|
+
const o = originOf(url)
|
|
30
|
+
return o && ORIGINS.has(o) ? 'include' : undefined
|
|
31
|
+
}
|