@devslab/dds-solid 0.29.2 → 0.31.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/README.ko.md +42 -0
- package/README.md +45 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +276 -203
- package/dist/index.js.map +1 -1
- package/dist/server.js +132 -38
- package/dist/server.js.map +1 -1
- package/dist/toast.d.ts +21 -3
- package/dist/toast.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/server.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Toast, Toaster, createToaster } from "@ark-ui/solid/toast";
|
|
|
27
27
|
import { space } from "@devslab/dds-tokens";
|
|
28
28
|
import { Tooltip as Tooltip$1, useTooltip } from "@ark-ui/solid/tooltip";
|
|
29
29
|
//#region src/left-nav.tsx
|
|
30
|
-
var _tmpl$$
|
|
30
|
+
var _tmpl$$8 = [
|
|
31
31
|
"<nav",
|
|
32
32
|
" class=\"dds-console-rail__nav dds-left-nav\"",
|
|
33
33
|
">",
|
|
@@ -92,7 +92,7 @@ function fillBadgeLabel(template, count) {
|
|
|
92
92
|
function LeftNav(props) {
|
|
93
93
|
const [internalExpandedGroups, setInternalExpandedGroups] = createSignal(props.defaultExpandedGroups ?? props.nav.flatMap((group, index) => group.collapsible && group.items.some((item) => isActive(props.activePath, item.href, item.active)) ? [group.id ?? `group-${index}`] : []));
|
|
94
94
|
const expanded = () => props.expandedGroups ?? internalExpandedGroups();
|
|
95
|
-
return ssr(_tmpl$$
|
|
95
|
+
return ssr(_tmpl$$8, ssrHydrationKey(), ssrAttribute("aria-label", escape(props.labels.nav, true), false), escape(createComponent(For, {
|
|
96
96
|
get each() {
|
|
97
97
|
return props.nav;
|
|
98
98
|
},
|
|
@@ -139,7 +139,7 @@ function LeftNav(props) {
|
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/layout.tsx
|
|
142
|
-
var _tmpl$$
|
|
142
|
+
var _tmpl$$7 = [
|
|
143
143
|
"<div",
|
|
144
144
|
" class=\"dds-console-shell dds-layout\"",
|
|
145
145
|
"><a class=\"dds-console-skip dds-visually-hidden\" href=\"",
|
|
@@ -209,11 +209,11 @@ function Layout(props) {
|
|
|
209
209
|
document.addEventListener("keydown", key);
|
|
210
210
|
onCleanup(() => document.removeEventListener("keydown", key));
|
|
211
211
|
});
|
|
212
|
-
return ssr(_tmpl$$
|
|
212
|
+
return ssr(_tmpl$$7, ssrHydrationKey(), ssrAttribute("data-navigation-position", escape(props.navigationPosition ?? "left", true), false) + ssrAttribute("data-surface", escape(props.surface, true), false) + ssrAttribute("data-hydrated", hydrated() ? "true" : escape(void 0, true), false), `#${escape(mainId, true)}`, escape(props.labels.skip), ssrAttribute("aria-controls", escape(railId, true), false) + ssrAttribute("aria-expanded", escape(open(), true), false), open() ? escape(props.labels.menuClose) : escape(props.labels.menuOpen), ssrAttribute("data-open", escape(String(open()), true), false), ssrAttribute("id", escape(railId, true), false), ssrAttribute("data-open", escape(String(open()), true), false), escape(props.railStart), escape(props.navigation), escape(props.railEnd), ssrAttribute("id", escape(mainId, true), false), ssrAttribute("data-width", escape(props.contentWidth ?? "workspace", true), false), props.header && ssr(_tmpl$2$4, ssrHydrationKey(), escape(props.header)), escape(props.children), props.footer && ssr(_tmpl$3$2, ssrHydrationKey(), escape(props.footer)));
|
|
213
213
|
}
|
|
214
214
|
//#endregion
|
|
215
215
|
//#region src/console-shell.tsx
|
|
216
|
-
var _tmpl$$
|
|
216
|
+
var _tmpl$$6 = [
|
|
217
217
|
"<a",
|
|
218
218
|
" class=\"dds-console-rail__brand\"",
|
|
219
219
|
"><img",
|
|
@@ -262,7 +262,7 @@ function ConsoleShell(props) {
|
|
|
262
262
|
return props.surface;
|
|
263
263
|
},
|
|
264
264
|
get railStart() {
|
|
265
|
-
return [ssr(_tmpl$$
|
|
265
|
+
return [ssr(_tmpl$$6, ssrHydrationKey(), ssrAttribute("href", escape(props.brand.href, true), false), ssrAttribute("src", escape(props.brand.mark, true), false), escape(props.brand.name)), createComponent(Show, {
|
|
266
266
|
get when() {
|
|
267
267
|
return memo(() => !!props.context)() && props.context.length > 0;
|
|
268
268
|
},
|
|
@@ -328,7 +328,7 @@ function ConsoleShell(props) {
|
|
|
328
328
|
}
|
|
329
329
|
//#endregion
|
|
330
330
|
//#region src/dialog.tsx
|
|
331
|
-
var _tmpl$$
|
|
331
|
+
var _tmpl$$5 = [
|
|
332
332
|
"<div",
|
|
333
333
|
">",
|
|
334
334
|
"</div>"
|
|
@@ -452,7 +452,7 @@ function Dialog(props) {
|
|
|
452
452
|
return props.children;
|
|
453
453
|
},
|
|
454
454
|
get actions() {
|
|
455
|
-
return props.actions && ssr(_tmpl$$
|
|
455
|
+
return props.actions && ssr(_tmpl$$5, ssrHydrationKey() + ssrAttribute("class", escape(cls("dds-dialog__actions", props.actionsClass), true), false), escape(props.actions));
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
return props.frame ? props.frame(parts) : [
|
|
@@ -551,7 +551,7 @@ function RadioGroup(props) {
|
|
|
551
551
|
}
|
|
552
552
|
//#endregion
|
|
553
553
|
//#region src/icon.tsx
|
|
554
|
-
var _tmpl$$
|
|
554
|
+
var _tmpl$$4 = ["<g>", "</g>"];
|
|
555
555
|
var _tmpl$2$2 = [
|
|
556
556
|
"<title",
|
|
557
557
|
">",
|
|
@@ -600,7 +600,7 @@ function Icon(props) {
|
|
|
600
600
|
"<!--$-->",
|
|
601
601
|
local.label && ssr(_tmpl$2$2, ssrHydrationKey(), escape(local.label)),
|
|
602
602
|
"<!--/-->",
|
|
603
|
-
ssr(_tmpl$$
|
|
603
|
+
ssr(_tmpl$$4, icon().body)
|
|
604
604
|
], true);
|
|
605
605
|
}
|
|
606
606
|
//#endregion
|
|
@@ -645,7 +645,7 @@ function createPendingAction() {
|
|
|
645
645
|
}
|
|
646
646
|
//#endregion
|
|
647
647
|
//#region src/status-pill.tsx
|
|
648
|
-
var _tmpl$$
|
|
648
|
+
var _tmpl$$3 = [
|
|
649
649
|
"<code",
|
|
650
650
|
" data-status=\"",
|
|
651
651
|
"\">",
|
|
@@ -679,7 +679,7 @@ function createStatusPill(config) {
|
|
|
679
679
|
return known() || !open.has(props.domain);
|
|
680
680
|
},
|
|
681
681
|
get fallback() {
|
|
682
|
-
return ssr(_tmpl$$
|
|
682
|
+
return ssr(_tmpl$$3, ssrHydrationKey(), `${escape(props.domain, true)}.${escape(props.value, true)}`, escape(props.value));
|
|
683
683
|
},
|
|
684
684
|
get children() {
|
|
685
685
|
return (() => {
|
|
@@ -806,6 +806,7 @@ function TabPanel(props) {
|
|
|
806
806
|
}
|
|
807
807
|
//#endregion
|
|
808
808
|
//#region src/toast.tsx
|
|
809
|
+
var _tmpl$$2 = ["<span", " class=\"dds-spinner\" aria-hidden=\"true\"></span>"];
|
|
809
810
|
var ToastContext = createContext();
|
|
810
811
|
function ToastProvider(props) {
|
|
811
812
|
const prefix = createUniqueId();
|
|
@@ -826,26 +827,108 @@ function ToastProvider(props) {
|
|
|
826
827
|
pauseOnPageIdle: true
|
|
827
828
|
});
|
|
828
829
|
let sequence = 0;
|
|
830
|
+
let disposed = false;
|
|
831
|
+
const records = /* @__PURE__ */ new Map();
|
|
832
|
+
const current = (record) => !disposed && records.get(record.id) === record && toaster.isVisible(record.id);
|
|
833
|
+
const remove = (id) => {
|
|
834
|
+
records.delete(id);
|
|
835
|
+
toaster.remove(id);
|
|
836
|
+
};
|
|
837
|
+
const optionsFor = (record) => {
|
|
838
|
+
const duration = record.duration ?? props.defaultDuration ?? 5e3;
|
|
839
|
+
return {
|
|
840
|
+
id: record.id,
|
|
841
|
+
description: record.message,
|
|
842
|
+
type: record.tone === "danger" ? "error" : record.tone ?? "info",
|
|
843
|
+
duration: record.tone === "loading" || duration <= 0 ? Infinity : duration,
|
|
844
|
+
meta: { dds: record },
|
|
845
|
+
action: record.action ? {
|
|
846
|
+
label: record.action.label,
|
|
847
|
+
onClick: () => {
|
|
848
|
+
if (!current(record)) return;
|
|
849
|
+
remove(record.id);
|
|
850
|
+
record.action?.onClick();
|
|
851
|
+
}
|
|
852
|
+
} : void 0,
|
|
853
|
+
onStatusChange: ({ status }) => {
|
|
854
|
+
if (status !== "visible" && records.get(record.id) === record) records.delete(record.id);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
const replace = (record, input) => {
|
|
859
|
+
if (!current(record)) return;
|
|
860
|
+
const next = {
|
|
861
|
+
...input,
|
|
862
|
+
id: record.id
|
|
863
|
+
};
|
|
864
|
+
records.set(record.id, next);
|
|
865
|
+
toaster.update(record.id, optionsFor(next));
|
|
866
|
+
};
|
|
867
|
+
const show = (input) => {
|
|
868
|
+
const id = `dds-toast-${prefix}-${++sequence}`;
|
|
869
|
+
if (!disposed) {
|
|
870
|
+
const record = {
|
|
871
|
+
...input,
|
|
872
|
+
id
|
|
873
|
+
};
|
|
874
|
+
records.set(id, record);
|
|
875
|
+
toaster.create(optionsFor(record));
|
|
876
|
+
}
|
|
877
|
+
return id;
|
|
878
|
+
};
|
|
829
879
|
const api = {
|
|
830
|
-
show
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
880
|
+
show,
|
|
881
|
+
loading: (input) => show({
|
|
882
|
+
...input,
|
|
883
|
+
tone: "loading"
|
|
884
|
+
}),
|
|
885
|
+
update(id, patch) {
|
|
886
|
+
const record = records.get(id);
|
|
887
|
+
if (record) replace(record, {
|
|
888
|
+
...record,
|
|
889
|
+
...patch
|
|
890
|
+
});
|
|
891
|
+
},
|
|
892
|
+
promise(operation, options) {
|
|
893
|
+
const id = api.loading(options.loading);
|
|
894
|
+
const record = records.get(id);
|
|
895
|
+
const settle = (terminal, value, tone) => {
|
|
896
|
+
if (!record || !current(record)) return;
|
|
897
|
+
try {
|
|
898
|
+
const input = typeof terminal === "function" ? terminal(value) : terminal;
|
|
899
|
+
replace(record, {
|
|
900
|
+
...record,
|
|
901
|
+
...input,
|
|
902
|
+
tone: input.tone ?? tone
|
|
903
|
+
});
|
|
904
|
+
} catch {
|
|
905
|
+
if (current(record)) remove(id);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
const result = Promise.resolve().then(() => typeof operation === "function" ? operation() : operation).then((value) => {
|
|
909
|
+
settle(options.success, value, "success");
|
|
910
|
+
return value;
|
|
911
|
+
}, (error) => {
|
|
912
|
+
settle(options.error, error, "danger");
|
|
913
|
+
throw error;
|
|
842
914
|
});
|
|
843
|
-
return id
|
|
915
|
+
return Object.defineProperty(result, "id", {
|
|
916
|
+
value: id,
|
|
917
|
+
enumerable: true
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
dismiss: (id) => {
|
|
921
|
+
if (!disposed) remove(id);
|
|
844
922
|
},
|
|
845
|
-
|
|
846
|
-
|
|
923
|
+
clear: () => {
|
|
924
|
+
records.clear();
|
|
925
|
+
toaster.remove();
|
|
926
|
+
}
|
|
847
927
|
};
|
|
848
|
-
onCleanup(
|
|
928
|
+
onCleanup(() => {
|
|
929
|
+
disposed = true;
|
|
930
|
+
api.clear();
|
|
931
|
+
});
|
|
849
932
|
return createComponent(ToastContext.Provider, {
|
|
850
933
|
value: api,
|
|
851
934
|
get children() {
|
|
@@ -866,21 +949,32 @@ function ToastProvider(props) {
|
|
|
866
949
|
const record = () => toast().meta?.dds;
|
|
867
950
|
return createComponent(Toast.Root, {
|
|
868
951
|
get ["class"]() {
|
|
869
|
-
return classes("dds-toast", `dds-toast--${record().tone ?? "info"}
|
|
952
|
+
return classes("dds-toast", `dds-toast--${record().tone ?? "info"}`, record().action && "dds-toast--action");
|
|
870
953
|
},
|
|
871
954
|
get role() {
|
|
872
955
|
return record().tone === "danger" ? "alert" : "status";
|
|
873
956
|
},
|
|
874
957
|
get children() {
|
|
875
|
-
return [
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
958
|
+
return [
|
|
959
|
+
record().tone === "loading" && ssr(_tmpl$$2, ssrHydrationKey()),
|
|
960
|
+
createComponent(Toast.Description, { get children() {
|
|
961
|
+
return toast().description;
|
|
962
|
+
} }),
|
|
963
|
+
record().action && createComponent(Toast.ActionTrigger, {
|
|
964
|
+
"class": "dds-btn dds-btn--secondary dds-btn--sm dds-toast__action",
|
|
965
|
+
type: "button",
|
|
966
|
+
get children() {
|
|
967
|
+
return record().action?.label;
|
|
968
|
+
}
|
|
969
|
+
}),
|
|
970
|
+
props.dismissLabel && createComponent(Toast.CloseTrigger, {
|
|
971
|
+
"class": "dds-iconbtn dds-iconbtn--sm",
|
|
972
|
+
get ["aria-label"]() {
|
|
973
|
+
return memo(() => typeof props.dismissLabel === "function")() ? props.dismissLabel(record()) : props.dismissLabel;
|
|
974
|
+
},
|
|
975
|
+
children: "×"
|
|
976
|
+
})
|
|
977
|
+
];
|
|
884
978
|
}
|
|
885
979
|
});
|
|
886
980
|
}
|