@dk-address/web 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/dk-address.js +5 -0
- package/dist/dk-address.js.map +112 -0
- package/dist/elements.d.ts +60 -0
- package/dist/elements.js +349 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/package.json +64 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type AdressevaelgerClient, type SearchKind } from "@dk-address/client";
|
|
2
|
+
import { type AutosuggestState, type Selection } from "@dk-address/core";
|
|
3
|
+
/** `<dk-address>`: the field. Its attributes are reflected by the properties of the same name. */
|
|
4
|
+
export interface DkAddressElement extends HTMLElement {
|
|
5
|
+
/** `address` leads down to floor and door; `accessAddress` stops at the house number. */
|
|
6
|
+
kind: SearchKind | null;
|
|
7
|
+
/** Only suggest addresses in these municipalities, like `["0101", "0147"]`. */
|
|
8
|
+
municipalityCodes: string[] | null;
|
|
9
|
+
/** The most suggestions per search, from 1 to 200. */
|
|
10
|
+
limit: number | null;
|
|
11
|
+
/** Delay in milliseconds before searching while typing. */
|
|
12
|
+
debounceMs: number | null;
|
|
13
|
+
/** Include provisional addresses (DAR's "foreløbige"). */
|
|
14
|
+
includeProvisional: boolean;
|
|
15
|
+
/** Match house numbers by prefix after a street is picked. On unless set to `false`. */
|
|
16
|
+
houseNumberPrefix: boolean;
|
|
17
|
+
/** Look up the full address after a final pick. On unless set to `false`. */
|
|
18
|
+
fetchDetails: boolean;
|
|
19
|
+
/** The id of a saved address, filled in when the field connects and when its form resets. */
|
|
20
|
+
defaultAddressId: string | null;
|
|
21
|
+
/** The name a hidden input submits the picked address's id under. */
|
|
22
|
+
idName: string | null;
|
|
23
|
+
/** The name the text submits under in a form. */
|
|
24
|
+
name: string | null;
|
|
25
|
+
/** The input must have text before the form submits. */
|
|
26
|
+
required: boolean;
|
|
27
|
+
/** The input can't be focused or edited. */
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
/** The input can be focused but not edited. */
|
|
30
|
+
readOnly: boolean;
|
|
31
|
+
/** Highlight the first suggestion while typing, so Enter picks it. */
|
|
32
|
+
autoHighlight: boolean;
|
|
33
|
+
/** Arrow keys wrap from the last suggestion to the first. */
|
|
34
|
+
loop: boolean;
|
|
35
|
+
/** The client that calls KDS. Set your own for a custom `fetch`, a proxy or tests. */
|
|
36
|
+
client: AdressevaelgerClient | undefined;
|
|
37
|
+
/** The text in the input. */
|
|
38
|
+
readonly value: string;
|
|
39
|
+
/** The finished pick, or `null` until a whole address is picked and after the text is edited. */
|
|
40
|
+
readonly selection: Selection | null;
|
|
41
|
+
/** The field's state: the text, gap, suggestions, search status and selection. `null` until it connects. */
|
|
42
|
+
readonly state: AutosuggestState | null;
|
|
43
|
+
/** Fill the field from a saved id without opening the list or taking focus. */
|
|
44
|
+
selectById(id: string): Promise<Selection | null>;
|
|
45
|
+
/** Empty the field and drop the pick. */
|
|
46
|
+
clear(): void;
|
|
47
|
+
}
|
|
48
|
+
/** `addressselect` on `<dk-address>`: a whole address was picked, with its details once looked up. */
|
|
49
|
+
export type AddressSelectEvent = CustomEvent<Selection>;
|
|
50
|
+
/** `statechange` on `<dk-address>`: the field's state changed. It doesn't bubble. */
|
|
51
|
+
export type StateChangeEvent = CustomEvent<AutosuggestState>;
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
"dk-address": DkAddressElement;
|
|
55
|
+
}
|
|
56
|
+
interface HTMLElementEventMap {
|
|
57
|
+
addressselect: AddressSelectEvent;
|
|
58
|
+
statechange: StateChangeEvent;
|
|
59
|
+
}
|
|
60
|
+
}
|
package/dist/elements.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { suggestionKey, } from "@dk-address/client";
|
|
2
|
+
import { createAddressAutosuggest, } from "@dk-address/core";
|
|
3
|
+
import { autocomplete } from "@ui-sdk/core/autocomplete";
|
|
4
|
+
import { createParts, wrappedButton, wrappedChild } from "@ui-sdk/web";
|
|
5
|
+
const bindings = new WeakMap();
|
|
6
|
+
/** Our attributes, beside the ones ui-sdk's Autocomplete takes (name, required, disabled and so on). */
|
|
7
|
+
const kinds = {
|
|
8
|
+
kind: "string",
|
|
9
|
+
municipalityCodes: "list",
|
|
10
|
+
limit: "number",
|
|
11
|
+
debounceMs: "number",
|
|
12
|
+
includeProvisional: "boolean",
|
|
13
|
+
houseNumberPrefix: "boolean",
|
|
14
|
+
fetchDetails: "boolean",
|
|
15
|
+
defaultAddressId: "string",
|
|
16
|
+
idName: "string",
|
|
17
|
+
// The store decides these, so they get no attribute.
|
|
18
|
+
defaultValue: null,
|
|
19
|
+
defaultOpen: null,
|
|
20
|
+
filter: null,
|
|
21
|
+
items: null,
|
|
22
|
+
emptyItems: null,
|
|
23
|
+
inlineComplete: null,
|
|
24
|
+
openOnFocus: null,
|
|
25
|
+
submitOnSelect: null,
|
|
26
|
+
controller: null,
|
|
27
|
+
};
|
|
28
|
+
const ownAttributes = [
|
|
29
|
+
"kind",
|
|
30
|
+
"municipality-codes",
|
|
31
|
+
"limit",
|
|
32
|
+
"debounce-ms",
|
|
33
|
+
"include-provisional",
|
|
34
|
+
"house-number-prefix",
|
|
35
|
+
"fetch-details",
|
|
36
|
+
];
|
|
37
|
+
function isListShown(state) {
|
|
38
|
+
return state.open && state.status !== "idle";
|
|
39
|
+
}
|
|
40
|
+
function optionsOf(el) {
|
|
41
|
+
return {
|
|
42
|
+
client: el.client,
|
|
43
|
+
kind: el.kind === "accessAddress" ? "accessAddress" : "address",
|
|
44
|
+
municipalityCodes: el.municipalityCodes?.length ? el.municipalityCodes : undefined,
|
|
45
|
+
limit: el.limit ?? undefined,
|
|
46
|
+
debounceMs: el.debounceMs ?? undefined,
|
|
47
|
+
includeProvisional: el.includeProvisional,
|
|
48
|
+
houseNumberPrefix: el.houseNumberPrefix,
|
|
49
|
+
fetchDetails: el.fetchDetails,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** One `<dk-address-item>` per suggestion, reusing the elements of suggestions that stay. */
|
|
53
|
+
function renderItems(list, suggestions) {
|
|
54
|
+
const existing = new Map();
|
|
55
|
+
for (const child of list.children) {
|
|
56
|
+
if (child.localName === "dk-address-item") {
|
|
57
|
+
existing.set(child.getAttribute("value") ?? "", child);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const next = suggestions.map((suggestion) => {
|
|
61
|
+
const key = suggestionKey(suggestion);
|
|
62
|
+
let item = existing.get(key);
|
|
63
|
+
existing.delete(key);
|
|
64
|
+
if (!item) {
|
|
65
|
+
item = document.createElement("dk-address-item");
|
|
66
|
+
item.setAttribute("value", key);
|
|
67
|
+
item.setAttribute("label", suggestion.label);
|
|
68
|
+
item.dataset.type = suggestion.type;
|
|
69
|
+
item.textContent = suggestion.label;
|
|
70
|
+
}
|
|
71
|
+
return item;
|
|
72
|
+
});
|
|
73
|
+
for (const item of existing.values())
|
|
74
|
+
item.remove();
|
|
75
|
+
next.forEach((item, index) => {
|
|
76
|
+
if (list.children[index] !== item)
|
|
77
|
+
list.insertBefore(item, list.children[index] ?? null);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const emptyText = new WeakMap();
|
|
81
|
+
/**
|
|
82
|
+
* Keep the empty part's text out of it until a search finds nothing. It's a live region, so the
|
|
83
|
+
* text appearing is what screen readers announce. ui-sdk's own empty element does the same.
|
|
84
|
+
*/
|
|
85
|
+
function showEmpty(empty, show) {
|
|
86
|
+
const stashed = emptyText.get(empty);
|
|
87
|
+
if (show && stashed) {
|
|
88
|
+
empty.append(stashed);
|
|
89
|
+
emptyText.delete(empty);
|
|
90
|
+
}
|
|
91
|
+
else if (!show && !stashed) {
|
|
92
|
+
const fragment = document.createDocumentFragment();
|
|
93
|
+
fragment.append(...empty.childNodes);
|
|
94
|
+
emptyText.set(empty, fragment);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const anchoredByUs = new WeakSet();
|
|
98
|
+
let controlIds = 0;
|
|
99
|
+
/**
|
|
100
|
+
* Line the popups up with the control, unless they name an anchor of their own. On web
|
|
101
|
+
* components, ui-sdk reads `anchor` as a CSS selector, so the control needs an id.
|
|
102
|
+
*/
|
|
103
|
+
function anchorPopups(el, control) {
|
|
104
|
+
for (const popup of el.querySelectorAll("dk-address-popup")) {
|
|
105
|
+
if (popup.hasAttribute("anchor") && !anchoredByUs.has(popup))
|
|
106
|
+
continue;
|
|
107
|
+
if (!control.id)
|
|
108
|
+
control.id = `dk-address-control-${++controlIds}`;
|
|
109
|
+
const selector = `#${CSS.escape(control.id)}`;
|
|
110
|
+
if (popup.getAttribute("anchor") !== selector)
|
|
111
|
+
popup.setAttribute("anchor", selector);
|
|
112
|
+
anchoredByUs.add(popup);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function syncHiddenId(el, selection) {
|
|
116
|
+
let hidden = el.querySelector(":scope > input[type=hidden][data-dk-address-id]");
|
|
117
|
+
if (!el.idName) {
|
|
118
|
+
hidden?.remove();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (!hidden) {
|
|
122
|
+
hidden = document.createElement("input");
|
|
123
|
+
hidden.type = "hidden";
|
|
124
|
+
hidden.dataset.dkAddressId = "";
|
|
125
|
+
el.append(hidden);
|
|
126
|
+
}
|
|
127
|
+
hidden.name = el.idName;
|
|
128
|
+
const form = el.getAttribute("form");
|
|
129
|
+
if (form)
|
|
130
|
+
hidden.setAttribute("form", form);
|
|
131
|
+
else
|
|
132
|
+
hidden.removeAttribute("form");
|
|
133
|
+
hidden.value = selection?.suggestion.id ?? "";
|
|
134
|
+
}
|
|
135
|
+
/** Copy the store's state onto the elements: the text, the list, the caret and the attributes. */
|
|
136
|
+
function apply(el, binding) {
|
|
137
|
+
const { state } = binding;
|
|
138
|
+
const shown = isListShown(state);
|
|
139
|
+
const host = el;
|
|
140
|
+
if (host.value !== state.value)
|
|
141
|
+
host.value = state.value;
|
|
142
|
+
const status = state.status === "success" ? "idle" : state.status;
|
|
143
|
+
if (host.status !== status)
|
|
144
|
+
host.status = status;
|
|
145
|
+
// As a boolean property, false would drop the attribute, and ui-sdk would stop controlling `open`.
|
|
146
|
+
const open = shown ? "true" : "false";
|
|
147
|
+
if (el.getAttribute("open") !== open)
|
|
148
|
+
el.setAttribute("open", open);
|
|
149
|
+
for (const list of el.querySelectorAll("dk-address-list"))
|
|
150
|
+
renderItems(list, state.suggestions);
|
|
151
|
+
const nothingFound = state.status === "success" && state.suggestions.length === 0;
|
|
152
|
+
for (const empty of el.querySelectorAll("dk-address-empty"))
|
|
153
|
+
showEmpty(empty, nothingFound);
|
|
154
|
+
const control = el.querySelector("dk-address-control");
|
|
155
|
+
control?.toggleAttribute("data-open", shown);
|
|
156
|
+
control?.toggleAttribute("data-loading", state.status === "loading");
|
|
157
|
+
if (control)
|
|
158
|
+
anchorPopups(el, control);
|
|
159
|
+
syncHiddenId(el, state.selection);
|
|
160
|
+
placeCaret(el, binding);
|
|
161
|
+
}
|
|
162
|
+
/** Move the caret where the store asks after a pick, only in a focused input. */
|
|
163
|
+
function placeCaret(el, binding) {
|
|
164
|
+
const { caret, value } = binding.state;
|
|
165
|
+
if (!caret || caret.revision === binding.caretRevision)
|
|
166
|
+
return;
|
|
167
|
+
binding.caretRevision = caret.revision;
|
|
168
|
+
const input = el.querySelector("dk-address-input input");
|
|
169
|
+
const place = () => {
|
|
170
|
+
if (!input || input.ownerDocument.activeElement !== input || input.value !== value)
|
|
171
|
+
return;
|
|
172
|
+
input.setSelectionRange(caret.position, caret.position);
|
|
173
|
+
};
|
|
174
|
+
place();
|
|
175
|
+
// ui-sdk writes the input's value after this runs, which moves the caret to the end again.
|
|
176
|
+
requestAnimationFrame(place);
|
|
177
|
+
}
|
|
178
|
+
function bind(el) {
|
|
179
|
+
const store = createAddressAutosuggest({
|
|
180
|
+
...optionsOf(el),
|
|
181
|
+
onSelect: (selection) => {
|
|
182
|
+
el.dispatchEvent(new CustomEvent("addressselect", { detail: selection, bubbles: true }));
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
const listeners = new AbortController();
|
|
186
|
+
const { signal } = listeners;
|
|
187
|
+
const binding = {
|
|
188
|
+
store,
|
|
189
|
+
state: store.getState(),
|
|
190
|
+
byKey: new Map(),
|
|
191
|
+
highlighted: null,
|
|
192
|
+
pickHandled: false,
|
|
193
|
+
caretRevision: null,
|
|
194
|
+
stop: () => { },
|
|
195
|
+
};
|
|
196
|
+
const pick = (key) => {
|
|
197
|
+
const suggestion = key ? binding.byKey.get(key) : undefined;
|
|
198
|
+
if (suggestion)
|
|
199
|
+
void store.select(suggestion);
|
|
200
|
+
};
|
|
201
|
+
const unsubscribe = store.subscribe(() => {
|
|
202
|
+
const state = store.getState();
|
|
203
|
+
if (state.suggestions !== binding.state.suggestions) {
|
|
204
|
+
binding.byKey = new Map(state.suggestions.map((s) => [suggestionKey(s), s]));
|
|
205
|
+
}
|
|
206
|
+
binding.state = state;
|
|
207
|
+
apply(el, binding);
|
|
208
|
+
el.dispatchEvent(new CustomEvent("statechange", { detail: state }));
|
|
209
|
+
});
|
|
210
|
+
el.addEventListener("valuechange", (event) => {
|
|
211
|
+
const { detail } = event;
|
|
212
|
+
switch (detail.reason) {
|
|
213
|
+
case "imperative":
|
|
214
|
+
return;
|
|
215
|
+
case "item-press":
|
|
216
|
+
// The store decides the text and caret after a pick.
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
binding.pickHandled = true;
|
|
219
|
+
pick(detail.item?.value);
|
|
220
|
+
return;
|
|
221
|
+
case "clear-press":
|
|
222
|
+
store.clear();
|
|
223
|
+
return;
|
|
224
|
+
case "escape-key":
|
|
225
|
+
// ui-sdk puts back the text last typed, which is stale once a pick rewrote it.
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
return;
|
|
228
|
+
default:
|
|
229
|
+
store.setInput(detail.value);
|
|
230
|
+
}
|
|
231
|
+
}, { signal });
|
|
232
|
+
el.addEventListener("openchange", (event) => {
|
|
233
|
+
const { detail } = event;
|
|
234
|
+
if (detail.reason === "imperative")
|
|
235
|
+
return;
|
|
236
|
+
if (detail.reason === "item-press") {
|
|
237
|
+
// When a pick's label equals the current text, ui-sdk skips the text change and the
|
|
238
|
+
// pick only shows up here, so fall back to the highlighted suggestion.
|
|
239
|
+
const highlighted = binding.highlighted;
|
|
240
|
+
queueMicrotask(() => {
|
|
241
|
+
if (!binding.pickHandled)
|
|
242
|
+
pick(highlighted);
|
|
243
|
+
binding.pickHandled = false;
|
|
244
|
+
});
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
store.setOpen(detail.value);
|
|
249
|
+
}, { signal });
|
|
250
|
+
el.addEventListener("highlight", (event) => {
|
|
251
|
+
const { value } = event.detail;
|
|
252
|
+
binding.highlighted = typeof value === "string" ? value : null;
|
|
253
|
+
}, { signal });
|
|
254
|
+
// ui-sdk reports no reset while the text is controlled, so follow the form ourselves.
|
|
255
|
+
el.ownerDocument.addEventListener("reset", (event) => {
|
|
256
|
+
const form = el.querySelector("dk-address-input input")?.form;
|
|
257
|
+
if (!form || event.target !== form)
|
|
258
|
+
return;
|
|
259
|
+
// A reset button's form resets its controls after this event, and after its microtasks.
|
|
260
|
+
setTimeout(() => {
|
|
261
|
+
store.clear();
|
|
262
|
+
if (el.defaultAddressId)
|
|
263
|
+
void store.selectById(el.defaultAddressId);
|
|
264
|
+
});
|
|
265
|
+
}, { signal });
|
|
266
|
+
const observer = new MutationObserver(() => store.setOptions(optionsOf(el)));
|
|
267
|
+
observer.observe(el, { attributeFilter: ownAttributes });
|
|
268
|
+
binding.stop = () => {
|
|
269
|
+
unsubscribe();
|
|
270
|
+
listeners.abort();
|
|
271
|
+
observer.disconnect();
|
|
272
|
+
store.destroy();
|
|
273
|
+
};
|
|
274
|
+
apply(el, binding);
|
|
275
|
+
if (el.defaultAddressId)
|
|
276
|
+
void store.selectById(el.defaultAddressId);
|
|
277
|
+
return binding;
|
|
278
|
+
}
|
|
279
|
+
const parts = createParts(autocomplete, {
|
|
280
|
+
root: {
|
|
281
|
+
tag: "dk-address",
|
|
282
|
+
display: "block",
|
|
283
|
+
kinds,
|
|
284
|
+
// Our own options aren't in the Autocomplete's type, which `defaults` is keyed by.
|
|
285
|
+
defaults: { houseNumberPrefix: true, fetchDetails: true },
|
|
286
|
+
properties: ["client"],
|
|
287
|
+
options: () => ({ filter: false }),
|
|
288
|
+
render: (host) => {
|
|
289
|
+
const el = host;
|
|
290
|
+
const binding = bindings.get(el);
|
|
291
|
+
if (binding)
|
|
292
|
+
binding.store.setOptions(optionsOf(el));
|
|
293
|
+
else
|
|
294
|
+
bindings.set(el, bind(el));
|
|
295
|
+
return () => {
|
|
296
|
+
// Runs before each render as well as when the element is gone, so check which.
|
|
297
|
+
queueMicrotask(() => {
|
|
298
|
+
if (el.isConnected)
|
|
299
|
+
return;
|
|
300
|
+
bindings.get(el)?.stop();
|
|
301
|
+
bindings.delete(el);
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
label: "dk-address-label",
|
|
307
|
+
input: { tag: "dk-address-input", target: wrappedChild("input"), display: "contents" },
|
|
308
|
+
clear: { tag: "dk-address-clear", target: wrappedButton, display: "contents" },
|
|
309
|
+
content: { tag: "dk-address-popup", display: "block" },
|
|
310
|
+
status: { tag: "dk-address-status", display: "block" },
|
|
311
|
+
empty: { tag: "dk-address-empty", display: "block" },
|
|
312
|
+
list: { tag: "dk-address-list", display: "block" },
|
|
313
|
+
item: { tag: "dk-address-item", display: "block" },
|
|
314
|
+
});
|
|
315
|
+
// The optional box around the input and clear button, which the popup lines up with. Only in a
|
|
316
|
+
// browser: on a server, where pages import this to render, there's no HTMLElement to extend.
|
|
317
|
+
if (typeof customElements !== "undefined" && !customElements.get("dk-address-control")) {
|
|
318
|
+
customElements.define("dk-address-control", class extends HTMLElement {
|
|
319
|
+
});
|
|
320
|
+
const style = document.createElement("style");
|
|
321
|
+
style.textContent = ":where(dk-address-control) { display: block; }";
|
|
322
|
+
document.head.append(style);
|
|
323
|
+
}
|
|
324
|
+
const Root = parts.Root;
|
|
325
|
+
if (Root) {
|
|
326
|
+
Object.defineProperties(Root.prototype, {
|
|
327
|
+
state: {
|
|
328
|
+
get() {
|
|
329
|
+
return bindings.get(this)?.state ?? null;
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
selection: {
|
|
333
|
+
get() {
|
|
334
|
+
return bindings.get(this)?.state.selection ?? null;
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
selectById: {
|
|
338
|
+
value(id) {
|
|
339
|
+
const binding = bindings.get(this);
|
|
340
|
+
return binding ? binding.store.selectById(id) : Promise.resolve(null);
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
clear: {
|
|
344
|
+
value() {
|
|
345
|
+
bindings.get(this)?.store.clear();
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "./elements.ts";
|
|
2
|
+
export type { AddressSelectEvent, DkAddressElement, StateChangeEvent } from "./elements.ts";
|
|
3
|
+
export { createClient, suggestionKey } from "@dk-address/client";
|
|
4
|
+
export type { AccessAddress, Address, AdressevaelgerClient, ClientOptions, SearchKind, Suggestion, SuggestionType, } from "@dk-address/client";
|
|
5
|
+
export type { AutosuggestState, Selection } from "@dk-address/core";
|
package/dist/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dk-address/web",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Danish address autocomplete as web components, built on KDS Adressevælger. For plain HTML and any framework.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"address",
|
|
7
|
+
"adressevaelger",
|
|
8
|
+
"adressevælger",
|
|
9
|
+
"autocomplete",
|
|
10
|
+
"custom-elements",
|
|
11
|
+
"danish",
|
|
12
|
+
"dar",
|
|
13
|
+
"dawa",
|
|
14
|
+
"denmark",
|
|
15
|
+
"kds",
|
|
16
|
+
"web-components"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://dk-address.dyrhoi.com/docs",
|
|
19
|
+
"bugs": "https://github.com/Dyrhoi/dk-address/issues",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/Dyrhoi/dk-address.git",
|
|
24
|
+
"directory": "packages/web"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"unpkg": "./dist/dk-address.js",
|
|
31
|
+
"jsdelivr": "./dist/dk-address.js",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && bun build ./src/index.ts --outdir ./dist --entry-naming \"dk-address.[ext]\" --target browser --format esm --production --sourcemap=linked",
|
|
43
|
+
"lint": "bun lint --deny-warnings",
|
|
44
|
+
"typecheck": "bun check",
|
|
45
|
+
"test": "vitest run"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@dk-address/client": "0.1.2",
|
|
49
|
+
"@dk-address/core": "0.1.2",
|
|
50
|
+
"@ui-sdk/core": "0.1.0-beta.17",
|
|
51
|
+
"@ui-sdk/web": "0.1.0-beta.17"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@repo/kds-fixtures": "0.0.0",
|
|
55
|
+
"@repo/oxlint-config": "0.0.0",
|
|
56
|
+
"@repo/typescript-config": "0.0.0",
|
|
57
|
+
"@repo/vitest-config": "0.0.0",
|
|
58
|
+
"@types/bun": "1.4.5",
|
|
59
|
+
"@vitest/browser-playwright": "5.1.1",
|
|
60
|
+
"playwright": "1.65.1",
|
|
61
|
+
"vite": "8.3.8",
|
|
62
|
+
"vitest": "5.1.1"
|
|
63
|
+
},
|
|
64
|
+
"main": "./dist/index.js",
|
|
65
|
+
"types": "./dist/index.d.ts"
|
|
66
|
+
}
|