@molecule/app-settings-container-vue 0.0.0-stage → 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/LICENSE +202 -0
- package/README.md +425 -2
- package/dist/SettingsContent.d.ts +25 -0
- package/dist/SettingsContent.d.ts.map +1 -0
- package/dist/SettingsContent.js +30 -0
- package/dist/SettingsContent.js.map +1 -0
- package/dist/SettingsLayout.d.ts +31 -0
- package/dist/SettingsLayout.d.ts.map +1 -0
- package/dist/SettingsLayout.js +47 -0
- package/dist/SettingsLayout.js.map +1 -0
- package/dist/SettingsSection.d.ts +33 -0
- package/dist/SettingsSection.d.ts.map +1 -0
- package/dist/SettingsSection.js +56 -0
- package/dist/SettingsSection.js.map +1 -0
- package/dist/SettingsSidebar.d.ts +53 -0
- package/dist/SettingsSidebar.d.ts.map +1 -0
- package/dist/SettingsSidebar.js +68 -0
- package/dist/SettingsSidebar.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes.d.ts +29 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +34 -0
- package/dist/nodes.js.map +1 -0
- package/dist/types.d.ts +85 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +63 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue two-column settings-page scaffold: optional header, sidebar on the left,
|
|
3
|
+
* content on the right.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
6
|
+
* `SettingsLayout` — the same props (React names), the same ClassMap tokens,
|
|
7
|
+
* and the same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type PropType, type VNode } from 'vue';
|
|
12
|
+
import type { SettingsLayoutProps } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Two-column Settings page scaffold: sidebar on the left, content on the
|
|
15
|
+
* right, optional (non-sticky) header above both.
|
|
16
|
+
*
|
|
17
|
+
* @param props - Component props (see {@link SettingsLayoutProps}).
|
|
18
|
+
* @returns The settings layout component.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SettingsLayout: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
21
|
+
sidebar: null;
|
|
22
|
+
header: null;
|
|
23
|
+
className: PropType<SettingsLayoutProps["className"]>;
|
|
24
|
+
dataMolId: PropType<SettingsLayoutProps["dataMolId"]>;
|
|
25
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
sidebar: null;
|
|
27
|
+
header: null;
|
|
28
|
+
className: PropType<SettingsLayoutProps["className"]>;
|
|
29
|
+
dataMolId: PropType<SettingsLayoutProps["dataMolId"]>;
|
|
30
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
31
|
+
//# sourceMappingURL=SettingsLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsLayout.d.ts","sourceRoot":"","sources":["../src/SettingsLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAA;AAKnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;eAOF,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;eAC1C,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;UAKpD,KAAK;;;eANK,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;eAC1C,QAAQ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;iGAuBjE,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue two-column settings-page scaffold: optional header, sidebar on the left,
|
|
3
|
+
* content on the right.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
6
|
+
* `SettingsLayout` — the same props (React names), the same ClassMap tokens,
|
|
7
|
+
* and the same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { defineComponent, h } from 'vue';
|
|
12
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
13
|
+
import { nodeValue } from './nodes.js';
|
|
14
|
+
/**
|
|
15
|
+
* Two-column Settings page scaffold: sidebar on the left, content on the
|
|
16
|
+
* right, optional (non-sticky) header above both.
|
|
17
|
+
*
|
|
18
|
+
* @param props - Component props (see {@link SettingsLayoutProps}).
|
|
19
|
+
* @returns The settings layout component.
|
|
20
|
+
*/
|
|
21
|
+
export const SettingsLayout = defineComponent({
|
|
22
|
+
name: 'SettingsLayout',
|
|
23
|
+
props: {
|
|
24
|
+
// Node-valued props: declared with `null` (any runtime type, no
|
|
25
|
+
// validation — a VNode, a string, or `null` to omit).
|
|
26
|
+
sidebar: null,
|
|
27
|
+
header: null,
|
|
28
|
+
className: String,
|
|
29
|
+
dataMolId: String,
|
|
30
|
+
},
|
|
31
|
+
setup(props, { slots }) {
|
|
32
|
+
const cm = getClassMap();
|
|
33
|
+
return () => h('div', {
|
|
34
|
+
'data-mol-id': props.dataMolId,
|
|
35
|
+
class: cm.cn(cm.stack(4), props.className),
|
|
36
|
+
}, [
|
|
37
|
+
...nodeValue(props.header, slots.header),
|
|
38
|
+
h('div', { class: cm.flex({ align: 'start', gap: 'lg' }) }, [
|
|
39
|
+
h('aside', { class: cm.shrink0 }, nodeValue(props.sidebar, slots.sidebar)),
|
|
40
|
+
h('main', { class: cm.flex1 }, [
|
|
41
|
+
h('div', { class: cm.stack(6) }, nodeValue(undefined, slots.default)),
|
|
42
|
+
]),
|
|
43
|
+
]),
|
|
44
|
+
]);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=SettingsLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsLayout.js","sourceRoot":"","sources":["../src/SettingsLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC,EAA6B,MAAM,KAAK,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE;QACL,gEAAgE;QAChE,sDAAsD;QACtD,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,MAAoD;QAC/D,SAAS,EAAE,MAAoD;KAChE;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;QAExB,OAAO,GAAU,EAAE,CACjB,CAAC,CACC,KAAK,EACL;YACE,aAAa,EAAE,KAAK,CAAC,SAAS;YAC9B,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC3C,EACD;YACE,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACxC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC1D,CAAC,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC1E,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC7B,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;iBACtE,CAAC;aACH,CAAC;SACH,CACF,CAAA;IACL,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Card-wrapped settings section: heading, optional description, body and
|
|
3
|
+
* optional footer action row.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
6
|
+
* `SettingsSection` — the same props (React names), the same ClassMap tokens,
|
|
7
|
+
* and the same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type PropType, type VNode } from 'vue';
|
|
12
|
+
import type { SettingsSectionProps } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* One configuration section inside a Settings page — Card-wrapped, with
|
|
15
|
+
* title / description header, body slot, and optional footer action row.
|
|
16
|
+
*
|
|
17
|
+
* @param props - Component props (see {@link SettingsSectionProps}).
|
|
18
|
+
* @returns The settings section component.
|
|
19
|
+
*/
|
|
20
|
+
export declare const SettingsSection: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
21
|
+
title: null;
|
|
22
|
+
description: null;
|
|
23
|
+
footer: null;
|
|
24
|
+
className: PropType<SettingsSectionProps["className"]>;
|
|
25
|
+
dataMolId: PropType<SettingsSectionProps["dataMolId"]>;
|
|
26
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
title: null;
|
|
28
|
+
description: null;
|
|
29
|
+
footer: null;
|
|
30
|
+
className: PropType<SettingsSectionProps["className"]>;
|
|
31
|
+
dataMolId: PropType<SettingsSectionProps["dataMolId"]>;
|
|
32
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
|
+
//# sourceMappingURL=SettingsSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsSection.d.ts","sourceRoot":"","sources":["../src/SettingsSection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAA;AAMnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;eAQH,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;eAC3C,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;UAKrD,KAAK;;;;eANK,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;eAC3C,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;iGA0ClE,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Card-wrapped settings section: heading, optional description, body and
|
|
3
|
+
* optional footer action row.
|
|
4
|
+
*
|
|
5
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
6
|
+
* `SettingsSection` — the same props (React names), the same ClassMap tokens,
|
|
7
|
+
* and the same DOM for the same input.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { defineComponent, h } from 'vue';
|
|
12
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
13
|
+
import { Card } from '@molecule/app-ui-vue';
|
|
14
|
+
import { hasNode, nodeValue } from './nodes.js';
|
|
15
|
+
/**
|
|
16
|
+
* One configuration section inside a Settings page — Card-wrapped, with
|
|
17
|
+
* title / description header, body slot, and optional footer action row.
|
|
18
|
+
*
|
|
19
|
+
* @param props - Component props (see {@link SettingsSectionProps}).
|
|
20
|
+
* @returns The settings section component.
|
|
21
|
+
*/
|
|
22
|
+
export const SettingsSection = defineComponent({
|
|
23
|
+
name: 'SettingsSection',
|
|
24
|
+
props: {
|
|
25
|
+
// Node-valued props: declared with `null` (any runtime type, no
|
|
26
|
+
// validation — a VNode, a string, or `null` to omit).
|
|
27
|
+
title: null,
|
|
28
|
+
description: null,
|
|
29
|
+
footer: null,
|
|
30
|
+
className: String,
|
|
31
|
+
dataMolId: String,
|
|
32
|
+
},
|
|
33
|
+
setup(props, { slots }) {
|
|
34
|
+
const cm = getClassMap();
|
|
35
|
+
return () => h(Card, {
|
|
36
|
+
className: props.className,
|
|
37
|
+
'data-mol-id': props.dataMolId,
|
|
38
|
+
}, {
|
|
39
|
+
default: () => [
|
|
40
|
+
h('div', { class: cm.stack(4) }, [
|
|
41
|
+
h('header', { class: cm.stack(1) }, [
|
|
42
|
+
h('h2', { class: cm.cn(cm.textSize('lg'), cm.fontWeight('semibold')) }, nodeValue(props.title, slots.title)),
|
|
43
|
+
hasNode(props.description, slots.description)
|
|
44
|
+
? h('p', { class: cm.textSize('sm') }, nodeValue(props.description, slots.description))
|
|
45
|
+
: null,
|
|
46
|
+
]),
|
|
47
|
+
h('div', null, nodeValue(undefined, slots.default)),
|
|
48
|
+
hasNode(props.footer, slots.footer)
|
|
49
|
+
? h('footer', { class: cm.flex({ justify: 'end', align: 'center', gap: 'sm' }) }, nodeValue(props.footer, slots.footer))
|
|
50
|
+
: null,
|
|
51
|
+
]),
|
|
52
|
+
],
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=SettingsSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsSection.js","sourceRoot":"","sources":["../src/SettingsSection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC,EAA6B,MAAM,KAAK,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE;QACL,gEAAgE;QAChE,sDAAsD;QACtD,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,MAAqD;QAChE,SAAS,EAAE,MAAqD;KACjE;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;QAExB,OAAO,GAAU,EAAE,CACjB,CAAC,CACC,IAAI,EACJ;YACE,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,aAAa,EAAE,KAAK,CAAC,SAAS;SAC/B,EACD;YACE,OAAO,EAAE,GAAG,EAAE,CAAC;gBACb,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;oBAC/B,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAU,CAAC,EAAE,EAAE;wBAC3C,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,EAC9D,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CACpC;wBACD,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;4BAC3C,CAAC,CAAC,CAAC,CACC,GAAG,EACH,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAC5B,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAChD;4BACH,CAAC,CAAC,IAAI;qBACT,CAAC;oBACF,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;oBACnD,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;wBACjC,CAAC,CAAC,CAAC,CACC,QAAQ,EACR,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAClE,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CACtC;wBACH,CAAC,CAAC,IAAI;iBACT,CAAC;aACH;SACF,CACF,CAAA;IACL,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue controlled settings side-nav.
|
|
3
|
+
*
|
|
4
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
5
|
+
* `SettingsSidebar` — the same props (React names), the same ClassMap tokens,
|
|
6
|
+
* and the same DOM for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { type PropType, type VNode } from 'vue';
|
|
11
|
+
import type { SettingsSidebarItem, SettingsSidebarProps } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Vertical side-nav for Settings pages. Controlled — the caller owns
|
|
14
|
+
* `activeId`; every item calls `onSelect` with its id.
|
|
15
|
+
*
|
|
16
|
+
* The nav region's accessible name resolves through `t()` with the
|
|
17
|
+
* `settingsContainer.aria.settings` key, so it follows the active locale;
|
|
18
|
+
* `ariaLabel` overrides it.
|
|
19
|
+
*
|
|
20
|
+
* @param props - Component props (see {@link SettingsSidebarProps}).
|
|
21
|
+
* @returns The settings sidebar component.
|
|
22
|
+
*/
|
|
23
|
+
export declare const SettingsSidebar: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
24
|
+
items: {
|
|
25
|
+
type: PropType<SettingsSidebarProps["items"]>;
|
|
26
|
+
default: () => never[];
|
|
27
|
+
};
|
|
28
|
+
activeId: PropType<SettingsSidebarProps["activeId"]>;
|
|
29
|
+
onSelect: PropType<SettingsSidebarProps["onSelect"]>;
|
|
30
|
+
footer: null;
|
|
31
|
+
ariaLabel: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
className: PropType<SettingsSidebarProps["className"]>;
|
|
36
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
37
|
+
items: {
|
|
38
|
+
type: PropType<SettingsSidebarProps["items"]>;
|
|
39
|
+
default: () => never[];
|
|
40
|
+
};
|
|
41
|
+
activeId: PropType<SettingsSidebarProps["activeId"]>;
|
|
42
|
+
onSelect: PropType<SettingsSidebarProps["onSelect"]>;
|
|
43
|
+
footer: null;
|
|
44
|
+
ariaLabel: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
className: PropType<SettingsSidebarProps["className"]>;
|
|
49
|
+
}>> & Readonly<{}>, {
|
|
50
|
+
items: SettingsSidebarItem[];
|
|
51
|
+
ariaLabel: string;
|
|
52
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
53
|
+
//# sourceMappingURL=SettingsSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsSidebar.d.ts","sourceRoot":"","sources":["../src/SettingsSidebar.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAmB,MAAM,KAAK,CAAA;AAMpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAE3E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe;;cAIP,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;;;cAGpC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;cACxC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;;;;;;eAK3C,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;UA8BrD,KAAK;;cAvCC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;;;cAGpC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;cACxC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;;;;;;eAK3C,QAAQ,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;;;;4EA+ClE,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue controlled settings side-nav.
|
|
3
|
+
*
|
|
4
|
+
* Vue counterpart of `@molecule/app-settings-container-react`'s
|
|
5
|
+
* `SettingsSidebar` — the same props (React names), the same ClassMap tokens,
|
|
6
|
+
* and the same DOM for the same input.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { defineComponent, h } from 'vue';
|
|
11
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
12
|
+
import { useTranslation } from '@molecule/app-vue';
|
|
13
|
+
import { hasNode, nodeValue } from './nodes.js';
|
|
14
|
+
/**
|
|
15
|
+
* Vertical side-nav for Settings pages. Controlled — the caller owns
|
|
16
|
+
* `activeId`; every item calls `onSelect` with its id.
|
|
17
|
+
*
|
|
18
|
+
* The nav region's accessible name resolves through `t()` with the
|
|
19
|
+
* `settingsContainer.aria.settings` key, so it follows the active locale;
|
|
20
|
+
* `ariaLabel` overrides it.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Component props (see {@link SettingsSidebarProps}).
|
|
23
|
+
* @returns The settings sidebar component.
|
|
24
|
+
*/
|
|
25
|
+
export const SettingsSidebar = defineComponent({
|
|
26
|
+
name: 'SettingsSidebar',
|
|
27
|
+
props: {
|
|
28
|
+
items: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => [],
|
|
31
|
+
},
|
|
32
|
+
activeId: String,
|
|
33
|
+
onSelect: Function,
|
|
34
|
+
// Node-valued prop: declared with `null` (any runtime type, no validation
|
|
35
|
+
// — a VNode, a string, or `null` to omit).
|
|
36
|
+
footer: null,
|
|
37
|
+
ariaLabel: { type: String, default: undefined },
|
|
38
|
+
className: String,
|
|
39
|
+
},
|
|
40
|
+
setup(props, { slots }) {
|
|
41
|
+
const cm = getClassMap();
|
|
42
|
+
const { t } = useTranslation();
|
|
43
|
+
/** One nav item's button (React's per-item classes and `aria-current`). */
|
|
44
|
+
const item = (entry) => {
|
|
45
|
+
const active = entry.id === props.activeId;
|
|
46
|
+
return h('button', {
|
|
47
|
+
// React keys each row by the item's `id`; Vue's `key` keeps the same
|
|
48
|
+
// DOM nodes across an equal or re-ordered array.
|
|
49
|
+
key: entry.id,
|
|
50
|
+
type: 'button',
|
|
51
|
+
onClick: () => props.onSelect?.(entry.id),
|
|
52
|
+
'aria-current': active ? 'page' : undefined,
|
|
53
|
+
class: cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('px', 3), cm.sp('py', 2), cm.textSize('sm'), active ? cm.fontWeight('semibold') : cm.fontWeight('medium')),
|
|
54
|
+
}, [entry.icon, h('span', null, [entry.label])]);
|
|
55
|
+
};
|
|
56
|
+
return () => h('nav', {
|
|
57
|
+
class: cm.cn(cm.stack(1), props.className),
|
|
58
|
+
'aria-label': props.ariaLabel ??
|
|
59
|
+
t('settingsContainer.aria.settings', undefined, { defaultValue: 'Settings' }),
|
|
60
|
+
}, [
|
|
61
|
+
...props.items.map(item),
|
|
62
|
+
...(hasNode(props.footer, slots.footer)
|
|
63
|
+
? [h('div', { class: cm.sp('mt', 4) }, nodeValue(props.footer, slots.footer))]
|
|
64
|
+
: []),
|
|
65
|
+
]);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=SettingsSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsSidebar.js","sourceRoot":"","sources":["../src/SettingsSidebar.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Settings-page scaffold (layout chrome only).
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<SettingsLayout>` — two-column [sidebar, content] with an optional
|
|
6
|
+
* `header` slot rendered above both.
|
|
7
|
+
* - `<SettingsSidebar>` — controlled side-nav (`items`, `activeId`,
|
|
8
|
+
* `onSelect`, optional `footer`); `SettingsSidebarItem` is
|
|
9
|
+
* `{ id, label, icon? }`.
|
|
10
|
+
* - `<SettingsContent>` — stacked wrapper for the right column.
|
|
11
|
+
* - `<SettingsSection>` — Card-wrapped titled section (`title`,
|
|
12
|
+
* `description?`, `footer?` action row, `dataMolId?`).
|
|
13
|
+
*
|
|
14
|
+
* It is the Vue counterpart of `@molecule/app-settings-container-react`: the
|
|
15
|
+
* same props (React names), the same ClassMap tokens, and the same DOM for the
|
|
16
|
+
* same input, so an app moves between frameworks by changing the package name
|
|
17
|
+
* in its imports.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { defineComponent, h, ref } from 'vue'
|
|
22
|
+
*
|
|
23
|
+
* import {
|
|
24
|
+
* SettingsContent,
|
|
25
|
+
* SettingsLayout,
|
|
26
|
+
* SettingsSection,
|
|
27
|
+
* SettingsSidebar,
|
|
28
|
+
* } from '@molecule/app-settings-container-vue'
|
|
29
|
+
*
|
|
30
|
+
* const NAV = [
|
|
31
|
+
* { id: 'profile', label: 'Profile' },
|
|
32
|
+
* { id: 'notifications', label: 'Notifications' },
|
|
33
|
+
* ]
|
|
34
|
+
*
|
|
35
|
+
* export const SettingsPage = defineComponent({
|
|
36
|
+
* setup() {
|
|
37
|
+
* const active = ref('profile')
|
|
38
|
+
* return () =>
|
|
39
|
+
* h(SettingsLayout, null, {
|
|
40
|
+
* sidebar: () => [
|
|
41
|
+
* h(SettingsSidebar, {
|
|
42
|
+
* items: NAV,
|
|
43
|
+
* activeId: active.value,
|
|
44
|
+
* onSelect: (id: string) => (active.value = id),
|
|
45
|
+
* }),
|
|
46
|
+
* ],
|
|
47
|
+
* default: () => [
|
|
48
|
+
* h(SettingsContent, null, {
|
|
49
|
+
* default: () => [
|
|
50
|
+
* h(
|
|
51
|
+
* SettingsSection,
|
|
52
|
+
* {
|
|
53
|
+
* title: 'Profile',
|
|
54
|
+
* description: 'Update your display name and avatar.',
|
|
55
|
+
* },
|
|
56
|
+
* { default: () => [h('p', null, 'Form fields go here.')] },
|
|
57
|
+
* ),
|
|
58
|
+
* ],
|
|
59
|
+
* }),
|
|
60
|
+
* ],
|
|
61
|
+
* })
|
|
62
|
+
* },
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* - The `header` slot is rendered above the columns but is NOT sticky —
|
|
68
|
+
* apply your own sticky positioning if you need it pinned.
|
|
69
|
+
* - The two columns do not collapse responsively — swap the sidebar for a
|
|
70
|
+
* drawer on small screens yourself.
|
|
71
|
+
* - Requires a bonded ClassMap. Labels are your own nodes (translate
|
|
72
|
+
* upstream); the sidebar nav's `aria-label="Settings"` is hardcoded
|
|
73
|
+
* English.
|
|
74
|
+
* - Don't confuse with `@molecule/app-settings-panel-vue`: that package is the
|
|
75
|
+
* batteries-included panel (prebuilt Account/Auth/Billing/… sections wired
|
|
76
|
+
* to molecule APIs). THIS package is empty layout chrome for building your
|
|
77
|
+
* own settings pages.
|
|
78
|
+
* - Node-valued props (`header`, `sidebar`, `footer`, `title`, `description`)
|
|
79
|
+
* arrive as a prop AND a same-named slot; components accept either.
|
|
80
|
+
*
|
|
81
|
+
* @module
|
|
82
|
+
*/
|
|
83
|
+
export * from './SettingsContent.js';
|
|
84
|
+
export * from './SettingsLayout.js';
|
|
85
|
+
export * from './SettingsSection.js';
|
|
86
|
+
export * from './SettingsSidebar.js';
|
|
87
|
+
export * from './types.js';
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Settings-page scaffold (layout chrome only).
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<SettingsLayout>` — two-column [sidebar, content] with an optional
|
|
6
|
+
* `header` slot rendered above both.
|
|
7
|
+
* - `<SettingsSidebar>` — controlled side-nav (`items`, `activeId`,
|
|
8
|
+
* `onSelect`, optional `footer`); `SettingsSidebarItem` is
|
|
9
|
+
* `{ id, label, icon? }`.
|
|
10
|
+
* - `<SettingsContent>` — stacked wrapper for the right column.
|
|
11
|
+
* - `<SettingsSection>` — Card-wrapped titled section (`title`,
|
|
12
|
+
* `description?`, `footer?` action row, `dataMolId?`).
|
|
13
|
+
*
|
|
14
|
+
* It is the Vue counterpart of `@molecule/app-settings-container-react`: the
|
|
15
|
+
* same props (React names), the same ClassMap tokens, and the same DOM for the
|
|
16
|
+
* same input, so an app moves between frameworks by changing the package name
|
|
17
|
+
* in its imports.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { defineComponent, h, ref } from 'vue'
|
|
22
|
+
*
|
|
23
|
+
* import {
|
|
24
|
+
* SettingsContent,
|
|
25
|
+
* SettingsLayout,
|
|
26
|
+
* SettingsSection,
|
|
27
|
+
* SettingsSidebar,
|
|
28
|
+
* } from '@molecule/app-settings-container-vue'
|
|
29
|
+
*
|
|
30
|
+
* const NAV = [
|
|
31
|
+
* { id: 'profile', label: 'Profile' },
|
|
32
|
+
* { id: 'notifications', label: 'Notifications' },
|
|
33
|
+
* ]
|
|
34
|
+
*
|
|
35
|
+
* export const SettingsPage = defineComponent({
|
|
36
|
+
* setup() {
|
|
37
|
+
* const active = ref('profile')
|
|
38
|
+
* return () =>
|
|
39
|
+
* h(SettingsLayout, null, {
|
|
40
|
+
* sidebar: () => [
|
|
41
|
+
* h(SettingsSidebar, {
|
|
42
|
+
* items: NAV,
|
|
43
|
+
* activeId: active.value,
|
|
44
|
+
* onSelect: (id: string) => (active.value = id),
|
|
45
|
+
* }),
|
|
46
|
+
* ],
|
|
47
|
+
* default: () => [
|
|
48
|
+
* h(SettingsContent, null, {
|
|
49
|
+
* default: () => [
|
|
50
|
+
* h(
|
|
51
|
+
* SettingsSection,
|
|
52
|
+
* {
|
|
53
|
+
* title: 'Profile',
|
|
54
|
+
* description: 'Update your display name and avatar.',
|
|
55
|
+
* },
|
|
56
|
+
* { default: () => [h('p', null, 'Form fields go here.')] },
|
|
57
|
+
* ),
|
|
58
|
+
* ],
|
|
59
|
+
* }),
|
|
60
|
+
* ],
|
|
61
|
+
* })
|
|
62
|
+
* },
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* - The `header` slot is rendered above the columns but is NOT sticky —
|
|
68
|
+
* apply your own sticky positioning if you need it pinned.
|
|
69
|
+
* - The two columns do not collapse responsively — swap the sidebar for a
|
|
70
|
+
* drawer on small screens yourself.
|
|
71
|
+
* - Requires a bonded ClassMap. Labels are your own nodes (translate
|
|
72
|
+
* upstream); the sidebar nav's `aria-label="Settings"` is hardcoded
|
|
73
|
+
* English.
|
|
74
|
+
* - Don't confuse with `@molecule/app-settings-panel-vue`: that package is the
|
|
75
|
+
* batteries-included panel (prebuilt Account/Auth/Billing/… sections wired
|
|
76
|
+
* to molecule APIs). THIS package is empty layout chrome for building your
|
|
77
|
+
* own settings pages.
|
|
78
|
+
* - Node-valued props (`header`, `sidebar`, `footer`, `title`, `description`)
|
|
79
|
+
* arrive as a prop AND a same-named slot; components accept either.
|
|
80
|
+
*
|
|
81
|
+
* @module
|
|
82
|
+
*/
|
|
83
|
+
export * from './SettingsContent.js';
|
|
84
|
+
export * from './SettingsLayout.js';
|
|
85
|
+
export * from './SettingsSection.js';
|
|
86
|
+
export * from './SettingsSidebar.js';
|
|
87
|
+
export * from './types.js';
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
|
package/dist/nodes.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-prop resolution for the Vue settings-page scaffold: every node-valued
|
|
3
|
+
* React prop arrives here as a prop AND a same-named slot, and the two must
|
|
4
|
+
* resolve to exactly what React renders.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { VNodeChild } from 'vue';
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a node-valued prop that may also arrive as a same-named slot: a
|
|
11
|
+
* given prop wins (React's single source of truth — a later `null` removes the
|
|
12
|
+
* node), and the slot is used only while the prop is absent. An absent pair
|
|
13
|
+
* contributes nothing.
|
|
14
|
+
*
|
|
15
|
+
* @param prop - The prop value, when the caller passed the prop.
|
|
16
|
+
* @param slot - The slot render function, when the caller passed the slot.
|
|
17
|
+
* @returns The children to render.
|
|
18
|
+
*/
|
|
19
|
+
export declare const nodeValue: (prop: VNodeChild, slot: (() => VNodeChild[]) | undefined) => VNodeChild[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether a node-valued prop or its same-named slot would render anything —
|
|
22
|
+
* React's `{node && …}` branch condition.
|
|
23
|
+
*
|
|
24
|
+
* @param prop - The prop value.
|
|
25
|
+
* @param slot - The slot render function, when provided.
|
|
26
|
+
* @returns True when the node renders.
|
|
27
|
+
*/
|
|
28
|
+
export declare const hasNode: (prop: VNodeChild, slot: (() => VNodeChild[]) | undefined) => boolean;
|
|
29
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,UAAU,EAChB,MAAM,CAAC,MAAM,UAAU,EAAE,CAAC,GAAG,SAAS,KACrC,UAAU,EAIZ,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,UAAU,EAAE,CAAC,GAAG,SAAS,KAAG,OACtB,CAAA"}
|
package/dist/nodes.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-prop resolution for the Vue settings-page scaffold: every node-valued
|
|
3
|
+
* React prop arrives here as a prop AND a same-named slot, and the two must
|
|
4
|
+
* resolve to exactly what React renders.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a node-valued prop that may also arrive as a same-named slot: a
|
|
10
|
+
* given prop wins (React's single source of truth — a later `null` removes the
|
|
11
|
+
* node), and the slot is used only while the prop is absent. An absent pair
|
|
12
|
+
* contributes nothing.
|
|
13
|
+
*
|
|
14
|
+
* @param prop - The prop value, when the caller passed the prop.
|
|
15
|
+
* @param slot - The slot render function, when the caller passed the slot.
|
|
16
|
+
* @returns The children to render.
|
|
17
|
+
*/
|
|
18
|
+
export const nodeValue = (prop, slot) => {
|
|
19
|
+
if (prop !== undefined)
|
|
20
|
+
return prop === null ? [] : [prop];
|
|
21
|
+
if (slot)
|
|
22
|
+
return slot();
|
|
23
|
+
return [];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Whether a node-valued prop or its same-named slot would render anything —
|
|
27
|
+
* React's `{node && …}` branch condition.
|
|
28
|
+
*
|
|
29
|
+
* @param prop - The prop value.
|
|
30
|
+
* @param slot - The slot render function, when provided.
|
|
31
|
+
* @returns True when the node renders.
|
|
32
|
+
*/
|
|
33
|
+
export const hasNode = (prop, slot) => Boolean(prop) || (prop === undefined && slot !== undefined);
|
|
34
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAgB,EAChB,IAAsC,EACxB,EAAE;IAChB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC1D,IAAI,IAAI;QAAE,OAAO,IAAI,EAAE,CAAA;IACvB,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAE,IAAsC,EAAW,EAAE,CAC3F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,CAAC,CAAA"}
|