juxscript 1.1.302 → 1.1.303
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/lib/components/button.d.ts.map +1 -1
- package/dist/lib/components/button.js +5 -0
- package/dist/lib/components/link.d.ts.map +1 -1
- package/dist/lib/components/link.js +5 -0
- package/dist/lib/components/list.d.ts.map +1 -1
- package/dist/lib/components/list.js +11 -2
- package/dist/lib/components/nav.d.ts.map +1 -1
- package/dist/lib/components/nav.js +11 -2
- package/dist/lib/utils/niceName.d.ts +14 -0
- package/dist/lib/utils/niceName.d.ts.map +1 -0
- package/dist/lib/utils/niceName.js +22 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../lib/components/button.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../lib/components/button.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,cAAM,MAAM;IACR,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAA0C;gBAE/C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;IA4DnD,QAAQ,IAAI,MAAM;IAClB,UAAU,IAAI,MAAM;IAEpB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW3B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE7B,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAM/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,UAAU,IAAI,iBAAiB;IAE/B,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;CAI9C;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAItE;AAED,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAInE;AAED,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AACjC,eAAe,MAAM,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import generateId from '../utils/idgen.js';
|
|
2
|
+
import niceName from '../utils/niceName.js';
|
|
2
3
|
import { pageState } from '../state/pageState.js';
|
|
3
4
|
class Button {
|
|
4
5
|
constructor(id, options = {}) {
|
|
@@ -11,6 +12,10 @@ class Button {
|
|
|
11
12
|
disabled: false,
|
|
12
13
|
...options
|
|
13
14
|
};
|
|
15
|
+
// Auto-generate content from ID if not provided
|
|
16
|
+
if (!this.opts.content && this.id) {
|
|
17
|
+
this.opts.content = niceName(this.id);
|
|
18
|
+
}
|
|
14
19
|
this._element = document.createElement('button');
|
|
15
20
|
this._element.id = this.id;
|
|
16
21
|
this._element.type = this.opts.type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../lib/components/link.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../lib/components/link.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,cAAM,IAAI;IACN,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,SAAS,CAA0C;gBAE/C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB;IA4EjD,QAAQ,IAAI,MAAM;IAClB,UAAU,IAAI,MAAM;IAEpB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM3B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE1B,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAU/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK3B,UAAU,IAAI,iBAAiB;IAE/B,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;CAI9C;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAIhE;AAED,wBAAgB,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAI7D;AAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC7B,eAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import generateId from '../utils/idgen.js';
|
|
2
|
+
import niceName from '../utils/niceName.js';
|
|
2
3
|
import { pageState } from '../state/pageState.js';
|
|
3
4
|
class Link {
|
|
4
5
|
constructor(id, options = {}) {
|
|
@@ -10,6 +11,10 @@ class Link {
|
|
|
10
11
|
disabled: false,
|
|
11
12
|
...options
|
|
12
13
|
};
|
|
14
|
+
// Auto-generate content from ID if not provided
|
|
15
|
+
if (!this.opts.content && this.id) {
|
|
16
|
+
this.opts.content = niceName(this.id);
|
|
17
|
+
}
|
|
13
18
|
this._element = document.createElement('a');
|
|
14
19
|
this._element.id = this.id;
|
|
15
20
|
this._element.className = this.opts.class || 'jux-link';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../lib/components/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../lib/components/list.ts"],"names":[],"mappings":"AAIA,UAAU,QAAQ;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED,UAAU,WAAW;IACjB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,OAAO,C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CAI1B;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAIhE;AAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AACvC,eAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import generateId from '../utils/idgen.js';
|
|
2
|
+
import niceName from '../utils/niceName.js';
|
|
2
3
|
import { pageState } from '../state/pageState.js';
|
|
3
4
|
class List {
|
|
4
5
|
constructor(id, options = {}) {
|
|
@@ -35,7 +36,11 @@ class List {
|
|
|
35
36
|
// STANDARD COLLECTION API
|
|
36
37
|
// ═══════════════════════════════════════════════════════════
|
|
37
38
|
addItem(item) {
|
|
38
|
-
const listItem = {
|
|
39
|
+
const listItem = {
|
|
40
|
+
...item,
|
|
41
|
+
id: item.id || `${this.id}-item-${this._items.length}`,
|
|
42
|
+
content: item.content || niceName(item.id || `item-${this._items.length}`)
|
|
43
|
+
};
|
|
39
44
|
this._items.push(listItem);
|
|
40
45
|
this._renderItem(listItem);
|
|
41
46
|
this._dispatchChange();
|
|
@@ -43,7 +48,11 @@ class List {
|
|
|
43
48
|
}
|
|
44
49
|
addItems(items) {
|
|
45
50
|
for (const item of items) {
|
|
46
|
-
const listItem = {
|
|
51
|
+
const listItem = {
|
|
52
|
+
...item,
|
|
53
|
+
id: item.id || `${this.id}-item-${this._items.length}`,
|
|
54
|
+
content: item.content || niceName(item.id || `item-${this._items.length}`)
|
|
55
|
+
};
|
|
47
56
|
this._items.push(listItem);
|
|
48
57
|
this._renderItem(listItem);
|
|
49
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../lib/components/nav.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../lib/components/nav.ts"],"names":[],"mappings":"AAIA,UAAU,OAAO;IACb,EAAE,C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I,GAAG,IAAI;IAOlC,UAAU,IAAI,WAAW;IAEzB,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI;IASlD,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,eAAe;CAI1B;AAED,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,GAAG,CAI7D;AAED,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACpC,eAAe,GAAG,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import generateId from '../utils/idgen.js';
|
|
2
|
+
import niceName from '../utils/niceName.js';
|
|
2
3
|
import { pageState } from '../state/pageState.js';
|
|
3
4
|
class Nav {
|
|
4
5
|
constructor(id, options = {}) {
|
|
@@ -33,7 +34,11 @@ class Nav {
|
|
|
33
34
|
// STANDARD COLLECTION API
|
|
34
35
|
// ═══════════════════════════════════════════════════════════
|
|
35
36
|
addItem(item) {
|
|
36
|
-
const navItem = {
|
|
37
|
+
const navItem = {
|
|
38
|
+
...item,
|
|
39
|
+
id: item.id || `${this.id}-item-${this._items.length}`,
|
|
40
|
+
label: item.label || niceName(item.id || `item-${this._items.length}`)
|
|
41
|
+
};
|
|
37
42
|
this._items.push(navItem);
|
|
38
43
|
this._renderItem(navItem);
|
|
39
44
|
this._dispatchChange();
|
|
@@ -41,7 +46,11 @@ class Nav {
|
|
|
41
46
|
}
|
|
42
47
|
addItems(items) {
|
|
43
48
|
for (const item of items) {
|
|
44
|
-
const navItem = {
|
|
49
|
+
const navItem = {
|
|
50
|
+
...item,
|
|
51
|
+
id: item.id || `${this.id}-item-${this._items.length}`,
|
|
52
|
+
label: item.label || niceName(item.id || `item-${this._items.length}`)
|
|
53
|
+
};
|
|
45
54
|
this._items.push(navItem);
|
|
46
55
|
this._renderItem(navItem);
|
|
47
56
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a kebab-case or snake_case ID into a human-readable label.
|
|
3
|
+
*
|
|
4
|
+
* Examples:
|
|
5
|
+
* 'my-button' → 'My Button'
|
|
6
|
+
* 'nav-home' → 'Nav Home'
|
|
7
|
+
* 'user_name' → 'User Name'
|
|
8
|
+
* 'firstName' → 'First Name'
|
|
9
|
+
* 'save-and-close' → 'Save And Close'
|
|
10
|
+
* 'already Nice' → 'Already Nice'
|
|
11
|
+
*/
|
|
12
|
+
export declare function niceName(id: string): string;
|
|
13
|
+
export default niceName;
|
|
14
|
+
//# sourceMappingURL=niceName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"niceName.d.ts","sourceRoot":"","sources":["../../../lib/utils/niceName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAS3C;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a kebab-case or snake_case ID into a human-readable label.
|
|
3
|
+
*
|
|
4
|
+
* Examples:
|
|
5
|
+
* 'my-button' → 'My Button'
|
|
6
|
+
* 'nav-home' → 'Nav Home'
|
|
7
|
+
* 'user_name' → 'User Name'
|
|
8
|
+
* 'firstName' → 'First Name'
|
|
9
|
+
* 'save-and-close' → 'Save And Close'
|
|
10
|
+
* 'already Nice' → 'Already Nice'
|
|
11
|
+
*/
|
|
12
|
+
export function niceName(id) {
|
|
13
|
+
return id
|
|
14
|
+
// Insert space before camelCase capitals: 'firstName' → 'first Name'
|
|
15
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
16
|
+
// Replace dashes, underscores, dots with spaces
|
|
17
|
+
.replace(/[-_.]+/g, ' ')
|
|
18
|
+
// Uppercase first letter of each word
|
|
19
|
+
.replace(/\b\w/g, c => c.toUpperCase())
|
|
20
|
+
.trim();
|
|
21
|
+
}
|
|
22
|
+
export default niceName;
|