juxscript 1.0.132 → 1.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.
Files changed (133) hide show
  1. package/README.md +1 -32
  2. package/bin/cli.js +4 -2
  3. package/index.d.ts +200 -0
  4. package/index.js +96 -22
  5. package/juxconfig.example.js +58 -63
  6. package/lib/components/alert.ts +200 -0
  7. package/lib/components/app.ts +247 -0
  8. package/lib/components/badge.ts +101 -0
  9. package/lib/components/base/BaseComponent.ts +421 -0
  10. package/lib/components/base/FormInput.ts +227 -0
  11. package/lib/components/button.ts +178 -0
  12. package/lib/components/card.ts +173 -0
  13. package/lib/components/chart.ts +231 -0
  14. package/lib/components/checkbox.ts +242 -0
  15. package/lib/components/code.ts +123 -0
  16. package/lib/components/container.ts +140 -0
  17. package/lib/components/data.ts +135 -0
  18. package/lib/components/datepicker.ts +234 -0
  19. package/lib/components/dialog.ts +172 -0
  20. package/lib/components/divider.ts +100 -0
  21. package/lib/components/dropdown.ts +186 -0
  22. package/lib/components/element.ts +267 -0
  23. package/lib/components/fileupload.ts +309 -0
  24. package/lib/components/grid.ts +291 -0
  25. package/lib/components/guard.ts +92 -0
  26. package/lib/components/heading.ts +96 -0
  27. package/lib/components/helpers.ts +41 -0
  28. package/lib/components/hero.ts +224 -0
  29. package/lib/components/icon.ts +178 -0
  30. package/lib/components/icons.ts +464 -0
  31. package/lib/components/include.ts +410 -0
  32. package/lib/components/input.ts +457 -0
  33. package/lib/components/list.ts +419 -0
  34. package/lib/components/loading.ts +100 -0
  35. package/lib/components/menu.ts +275 -0
  36. package/lib/components/modal.ts +284 -0
  37. package/lib/components/nav.ts +257 -0
  38. package/lib/components/paragraph.ts +97 -0
  39. package/lib/components/progress.ts +159 -0
  40. package/lib/components/radio.ts +278 -0
  41. package/lib/components/req.ts +303 -0
  42. package/lib/components/script.ts +41 -0
  43. package/lib/components/select.ts +252 -0
  44. package/lib/components/sidebar.ts +275 -0
  45. package/lib/components/style.ts +41 -0
  46. package/lib/components/switch.ts +246 -0
  47. package/lib/components/table.ts +1249 -0
  48. package/lib/components/tabs.ts +250 -0
  49. package/lib/components/theme-toggle.ts +293 -0
  50. package/lib/components/tooltip.ts +144 -0
  51. package/lib/components/view.ts +190 -0
  52. package/lib/components/write.ts +272 -0
  53. package/lib/globals.d.ts +19 -5
  54. package/lib/layouts/default.css +260 -0
  55. package/lib/layouts/figma.css +334 -0
  56. package/lib/reactivity/state.ts +78 -0
  57. package/lib/utils/{fetch.js → fetch.ts} +206 -81
  58. package/machinery/ast.js +347 -0
  59. package/machinery/build.js +466 -0
  60. package/machinery/compiler3.js +6 -66
  61. package/machinery/config.js +6 -93
  62. package/machinery/doc-generator.js +136 -0
  63. package/machinery/imports.js +155 -0
  64. package/machinery/server.js +166 -0
  65. package/machinery/ts-shim.js +46 -0
  66. package/machinery/watcher.js +162 -50
  67. package/package.json +9 -30
  68. package/create/index.jux +0 -77
  69. package/create/layout.jux +0 -18
  70. package/create/style.css +0 -57
  71. package/create/themes/assets/jux.svg +0 -34
  72. package/create/themes/base.css +0 -197
  73. package/create/themes/base2.css +0 -54
  74. package/create/themes/layouts/base.jux +0 -16
  75. package/create/themes/layouts/base_marketing.jux +0 -0
  76. package/create/themes/layouts/base_saas.jux +0 -0
  77. package/lib/componentsv2/base/BaseEngine.d.ts +0 -112
  78. package/lib/componentsv2/base/BaseEngine.js +0 -279
  79. package/lib/componentsv2/base/BaseSkin.d.ts +0 -74
  80. package/lib/componentsv2/base/BaseSkin.js +0 -130
  81. package/lib/componentsv2/base/Neighborhood.d.ts +0 -22
  82. package/lib/componentsv2/base/Neighborhood.js +0 -56
  83. package/lib/componentsv2/base/OptionsContract.d.ts +0 -20
  84. package/lib/componentsv2/base/OptionsContract.js +0 -107
  85. package/lib/componentsv2/base/State.d.ts +0 -18
  86. package/lib/componentsv2/base/State.js +0 -68
  87. package/lib/componentsv2/element/Element.d.ts +0 -30
  88. package/lib/componentsv2/element/Element.js +0 -50
  89. package/lib/componentsv2/element/ElementEngine.d.ts +0 -59
  90. package/lib/componentsv2/element/ElementEngine.js +0 -118
  91. package/lib/componentsv2/element/ElementSkin.d.ts +0 -10
  92. package/lib/componentsv2/element/ElementSkin.js +0 -56
  93. package/lib/componentsv2/element/structure.css +0 -261
  94. package/lib/componentsv2/grid/Grid.d.ts +0 -13
  95. package/lib/componentsv2/grid/Grid.js +0 -27
  96. package/lib/componentsv2/grid/GridEngine.d.ts +0 -77
  97. package/lib/componentsv2/grid/GridEngine.js +0 -153
  98. package/lib/componentsv2/grid/GridSkin.d.ts +0 -11
  99. package/lib/componentsv2/grid/GridSkin.js +0 -84
  100. package/lib/componentsv2/grid/structure.css +0 -27
  101. package/lib/componentsv2/input/Input.d.ts +0 -6
  102. package/lib/componentsv2/input/Input.js +0 -21
  103. package/lib/componentsv2/input/InputEngine.d.ts +0 -70
  104. package/lib/componentsv2/input/InputEngine.js +0 -143
  105. package/lib/componentsv2/input/InputSkin.d.ts +0 -11
  106. package/lib/componentsv2/input/InputSkin.js +0 -89
  107. package/lib/componentsv2/input/structure.css +0 -47
  108. package/lib/componentsv2/list/List.d.ts +0 -49
  109. package/lib/componentsv2/list/List.js +0 -105
  110. package/lib/componentsv2/list/ListEngine.d.ts +0 -121
  111. package/lib/componentsv2/list/ListEngine.js +0 -322
  112. package/lib/componentsv2/list/ListSkin.d.ts +0 -20
  113. package/lib/componentsv2/list/ListSkin.js +0 -345
  114. package/lib/componentsv2/list/structure.css +0 -359
  115. package/lib/componentsv2/plugins/ClientSQLitePlugin.d.ts +0 -21
  116. package/lib/componentsv2/plugins/ClientSQLitePlugin.js +0 -130
  117. package/lib/componentsv2/plugins/IndexedDBPlugin.d.ts +0 -18
  118. package/lib/componentsv2/plugins/IndexedDBPlugin.js +0 -75
  119. package/lib/componentsv2/plugins/LocalStoragePlugin.d.ts +0 -20
  120. package/lib/componentsv2/plugins/LocalStoragePlugin.js +0 -65
  121. package/lib/componentsv2/plugins/ServerSQLitePlugin.d.ts +0 -25
  122. package/lib/componentsv2/plugins/ServerSQLitePlugin.js +0 -70
  123. package/lib/componentsv2/stubs/ComponentComposition.ts.stub +0 -32
  124. package/lib/componentsv2/stubs/ComponentEngine.ts.stub +0 -36
  125. package/lib/componentsv2/stubs/ComponentSkin.ts.stub +0 -35
  126. package/lib/componentsv2/stubs/ComponentStructure.css.d.ts.stub +0 -2
  127. package/lib/componentsv2/stubs/ComponentStructure.css.stub +0 -13
  128. package/lib/utils/fetch.d.ts +0 -176
  129. package/machinery/serve.js +0 -255
  130. package/types/css.d.ts +0 -10
  131. /package/{create/themes/layouts/base_blog.jux → machinery/bundleAssets.js} +0 -0
  132. /package/{create/themes/layouts/base_docs.jux → machinery/bundleJux.js} +0 -0
  133. /package/{create/themes/layouts/base_login.jux → machinery/bundleVendors.js} +0 -0
@@ -1,70 +0,0 @@
1
- import { BaseEngine, BaseState } from '../base/BaseEngine.js';
2
- import { OptionsContractSchema } from '../base/OptionsContract.js';
3
- export interface InputState extends BaseState {
4
- value: string;
5
- label: string | null;
6
- placeholder: string;
7
- type: 'text' | 'number' | 'password' | 'email';
8
- error: string | null;
9
- readonly: boolean;
10
- }
11
- export interface InputOptions {
12
- value?: string | number;
13
- label?: string | null;
14
- placeholder?: string;
15
- type?: 'text' | 'number' | 'password' | 'email';
16
- error?: string | null;
17
- readonly?: boolean;
18
- }
19
- export declare class InputEngine extends BaseEngine<InputState, InputOptions> {
20
- constructor(id: string, options?: InputOptions);
21
- /**
22
- * OPTIONS CONTRACT
23
- * Defines valid options with types, defaults, and aliases for common mistakes.
24
- */
25
- protected get optionsSchema(): OptionsContractSchema;
26
- protected prepareState(id: string, options: InputOptions): InputState;
27
- /**
28
- * Set input value
29
- * Method name matches state property: value
30
- */
31
- value(val: string | number): this;
32
- /**
33
- * Set label text
34
- * Method name matches state property: label
35
- */
36
- label(text: string | null): this;
37
- /**
38
- * Set placeholder text
39
- * Method name matches state property: placeholder
40
- */
41
- placeholder(text: string): this;
42
- /**
43
- * Set input type
44
- * Method name matches state property: type
45
- */
46
- type(inputType: 'text' | 'number' | 'password' | 'email'): this;
47
- /**
48
- * Set error message
49
- * Method name matches state property: error
50
- */
51
- error(message: string | null): this;
52
- /**
53
- * Set readonly state
54
- * Method name matches state property: readonly
55
- */
56
- readonly(isReadonly: boolean): this;
57
- /** @alias for value() */
58
- setValue(val: string | number): this;
59
- /** @alias for label() */
60
- setLabel(text: string): this;
61
- /** @alias for placeholder() */
62
- setPlaceholder(text: string): this;
63
- /** @alias for error() */
64
- setError(message: string | null): this;
65
- /** @alias for type() */
66
- setType(inputType: 'text' | 'number' | 'password' | 'email'): this;
67
- /** @alias for readonly() */
68
- setReadonly(isReadonly: boolean): this;
69
- }
70
- //# sourceMappingURL=InputEngine.d.ts.map
@@ -1,143 +0,0 @@
1
- import { BaseEngine } from '../base/BaseEngine.js';
2
- export class InputEngine extends BaseEngine {
3
- constructor(id, options = {}) {
4
- super(id, options);
5
- }
6
- /**
7
- * OPTIONS CONTRACT
8
- * Defines valid options with types, defaults, and aliases for common mistakes.
9
- */
10
- get optionsSchema() {
11
- return {
12
- value: {
13
- type: 'string',
14
- default: '',
15
- description: 'Input value',
16
- aliases: ['val', 'text', 'content', 'defaultValue', 'initialValue']
17
- },
18
- label: {
19
- type: 'string',
20
- default: null,
21
- description: 'Label text displayed above input',
22
- aliases: ['title', 'name', 'labelText']
23
- },
24
- placeholder: {
25
- type: 'string',
26
- default: '',
27
- description: 'Placeholder text when input is empty',
28
- aliases: ['hint', 'placeholderText']
29
- },
30
- type: {
31
- type: 'string',
32
- default: 'text',
33
- description: 'Input type: "text", "number", "password", "email"',
34
- aliases: ['inputType', 'kind']
35
- },
36
- error: {
37
- type: 'string',
38
- default: null,
39
- description: 'Error message to display',
40
- aliases: ['errorMessage', 'errorText', 'validationError']
41
- },
42
- readonly: {
43
- type: 'boolean',
44
- default: false,
45
- description: 'Make input read-only',
46
- aliases: ['readOnly', 'isReadonly', 'editable']
47
- }
48
- };
49
- }
50
- prepareState(id, options) {
51
- return {
52
- id,
53
- classes: ['jux-input-wrapper'],
54
- visible: true,
55
- disabled: false,
56
- loading: false,
57
- attributes: {},
58
- value: options.value !== undefined ? String(options.value) : '',
59
- label: options.label ?? null,
60
- placeholder: options.placeholder || '',
61
- type: options.type || 'text',
62
- error: options.error ?? null,
63
- readonly: options.readonly || false
64
- };
65
- }
66
- // --- State-Aligned Methods ---
67
- /**
68
- * Set input value
69
- * Method name matches state property: value
70
- */
71
- value(val) {
72
- this.updateState({ value: String(val) });
73
- this.emit('change', { value: val });
74
- return this;
75
- }
76
- /**
77
- * Set label text
78
- * Method name matches state property: label
79
- */
80
- label(text) {
81
- this.updateState({ label: text });
82
- return this;
83
- }
84
- /**
85
- * Set placeholder text
86
- * Method name matches state property: placeholder
87
- */
88
- placeholder(text) {
89
- this.updateState({ placeholder: text });
90
- return this;
91
- }
92
- /**
93
- * Set input type
94
- * Method name matches state property: type
95
- */
96
- type(inputType) {
97
- this.updateState({ type: inputType });
98
- return this;
99
- }
100
- /**
101
- * Set error message
102
- * Method name matches state property: error
103
- */
104
- error(message) {
105
- this.updateState({ error: message });
106
- this.emit('validation', { valid: !message, error: message });
107
- return this;
108
- }
109
- /**
110
- * Set readonly state
111
- * Method name matches state property: readonly
112
- */
113
- readonly(isReadonly) {
114
- this.updateState({ readonly: isReadonly });
115
- return this;
116
- }
117
- // --- Convenience Aliases ---
118
- /** @alias for value() */
119
- setValue(val) {
120
- return this.value(val);
121
- }
122
- /** @alias for label() */
123
- setLabel(text) {
124
- return this.label(text);
125
- }
126
- /** @alias for placeholder() */
127
- setPlaceholder(text) {
128
- return this.placeholder(text);
129
- }
130
- /** @alias for error() */
131
- setError(message) {
132
- return this.error(message);
133
- }
134
- /** @alias for type() */
135
- setType(inputType) {
136
- return this.type(inputType);
137
- }
138
- /** @alias for readonly() */
139
- setReadonly(isReadonly) {
140
- return this.readonly(isReadonly);
141
- }
142
- }
143
- //# sourceMappingURL=InputEngine.js.map
@@ -1,11 +0,0 @@
1
- import { BaseSkin } from '../base/BaseSkin.js';
2
- import { InputEngine, InputState } from './InputEngine.js';
3
- export declare class InputSkin extends BaseSkin<InputState, InputEngine> {
4
- #private;
5
- constructor(engine: InputEngine);
6
- protected get structureCss(): string;
7
- protected createRoot(): HTMLElement;
8
- protected bindEvents(root: HTMLElement): void;
9
- protected updateSkin(state: InputState): void;
10
- }
11
- //# sourceMappingURL=InputSkin.d.ts.map
@@ -1,89 +0,0 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _InputSkin_labelEl, _InputSkin_inputEl, _InputSkin_errorEl;
13
- import { BaseSkin } from '../base/BaseSkin.js';
14
- import structureCss from './structure.css';
15
- export class InputSkin extends BaseSkin {
16
- constructor(engine) {
17
- super(engine);
18
- _InputSkin_labelEl.set(this, null);
19
- _InputSkin_inputEl.set(this, null);
20
- _InputSkin_errorEl.set(this, null);
21
- }
22
- get structureCss() {
23
- return structureCss;
24
- }
25
- createRoot() {
26
- return document.createElement('div');
27
- }
28
- bindEvents(root) {
29
- root.addEventListener('input', (e) => {
30
- const target = e.target;
31
- if (target === __classPrivateFieldGet(this, _InputSkin_inputEl, "f")) {
32
- this.engine.value(target.value);
33
- }
34
- });
35
- }
36
- updateSkin(state) {
37
- if (!this.root)
38
- return;
39
- this.applySkinAttributes(this.root, state);
40
- // Ensure DOM Structure
41
- if (!__classPrivateFieldGet(this, _InputSkin_inputEl, "f")) {
42
- this.root.innerHTML = ''; // Reset
43
- // 1. Label
44
- __classPrivateFieldSet(this, _InputSkin_labelEl, document.createElement('label'), "f");
45
- __classPrivateFieldGet(this, _InputSkin_labelEl, "f").className = 'jux-input-label';
46
- __classPrivateFieldGet(this, _InputSkin_labelEl, "f").htmlFor = `input-${state.id}`;
47
- this.root.appendChild(__classPrivateFieldGet(this, _InputSkin_labelEl, "f"));
48
- // 2. Input
49
- __classPrivateFieldSet(this, _InputSkin_inputEl, document.createElement('input'), "f");
50
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").id = `input-${state.id}`;
51
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").className = 'jux-input-control';
52
- this.root.appendChild(__classPrivateFieldGet(this, _InputSkin_inputEl, "f"));
53
- // 3. Error
54
- __classPrivateFieldSet(this, _InputSkin_errorEl, document.createElement('div'), "f");
55
- __classPrivateFieldGet(this, _InputSkin_errorEl, "f").className = 'jux-input-error';
56
- this.root.appendChild(__classPrivateFieldGet(this, _InputSkin_errorEl, "f"));
57
- }
58
- // Apply State
59
- this.root.className = state.classes.join(' ');
60
- if (state.label) {
61
- __classPrivateFieldGet(this, _InputSkin_labelEl, "f").textContent = state.label;
62
- __classPrivateFieldGet(this, _InputSkin_labelEl, "f").style.display = 'block';
63
- }
64
- else {
65
- __classPrivateFieldGet(this, _InputSkin_labelEl, "f").style.display = 'none';
66
- }
67
- // Only update value if different to prevent cursor jumps
68
- if (__classPrivateFieldGet(this, _InputSkin_inputEl, "f").value !== state.value) {
69
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").value = state.value;
70
- }
71
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").type = state.type;
72
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").placeholder = state.placeholder;
73
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").disabled = state.disabled || state.loading;
74
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").readOnly = state.readonly;
75
- if (state.error) {
76
- __classPrivateFieldGet(this, _InputSkin_errorEl, "f").textContent = state.error;
77
- __classPrivateFieldGet(this, _InputSkin_errorEl, "f").style.display = 'block';
78
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").setAttribute('aria-invalid', 'true');
79
- this.root.classList.add('has-error');
80
- }
81
- else {
82
- __classPrivateFieldGet(this, _InputSkin_errorEl, "f").style.display = 'none';
83
- __classPrivateFieldGet(this, _InputSkin_inputEl, "f").removeAttribute('aria-invalid');
84
- this.root.classList.remove('has-error');
85
- }
86
- }
87
- }
88
- _InputSkin_labelEl = new WeakMap(), _InputSkin_inputEl = new WeakMap(), _InputSkin_errorEl = new WeakMap();
89
- //# sourceMappingURL=InputSkin.js.map
@@ -1,47 +0,0 @@
1
- .jux-input-wrapper {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 4px; /* Space between label and input */
5
- font-family: inherit;
6
- width: 100%;
7
- }
8
-
9
- .jux-input-label {
10
- font-size: 0.85rem;
11
- font-weight: 500;
12
- color: #444;
13
- }
14
-
15
- .jux-input-control {
16
- padding: 8px 12px;
17
- border: 1px solid #ccc;
18
- border-radius: 4px;
19
- font-size: 1rem;
20
- transition: border-color 0.2s, box-shadow 0.2s;
21
- }
22
-
23
- .jux-input-control:focus {
24
- outline: none;
25
- border-color: #007bff;
26
- box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
27
- }
28
-
29
- .jux-input-control:disabled {
30
- background-color: #f5f5f5;
31
- cursor: not-allowed;
32
- opacity: 0.7;
33
- }
34
-
35
- .jux-input-error {
36
- font-size: 0.75rem;
37
- color: #dc3545;
38
- min-height: 1.2em; /* Prevent layout jump */
39
- }
40
-
41
- /* Error State Overrides */
42
- .jux-input-wrapper.has-error .jux-input-control {
43
- border-color: #dc3545;
44
- }
45
- .jux-input-wrapper.has-error .jux-input-label {
46
- color: #dc3545;
47
- }
@@ -1,49 +0,0 @@
1
- import { ListEngine, ListOptions } from './ListEngine.js';
2
- import { JuxServiceContract } from '../base/BaseEngine.js';
3
- export type ListKnob = 'add' | 'edit' | 'move' | 'search' | 'delete' | 'sort';
4
- export type ListComponent = ListEngine & {
5
- render: (targetId: string | HTMLElement) => ListComponent;
6
- injectCSS: (id: string, cssContent: string) => void;
7
- enableSearch: (enabled?: boolean) => ListComponent;
8
- enableAdd: (enabled?: boolean) => ListComponent;
9
- enableDelete: (enabled?: boolean) => ListComponent;
10
- enableEdit: (enabled?: boolean) => ListComponent;
11
- enableMove: (enabled?: boolean) => ListComponent;
12
- enableSort: (enabled?: boolean) => ListComponent;
13
- enableNoItems: (message?: string) => ListComponent;
14
- knobs: (features: ListKnob[]) => ListComponent;
15
- addPlugin: (plugin: JuxServiceContract<ListEngine>) => ListComponent;
16
- };
17
- /**
18
- * OPTIONS CONTRACT for List:
19
- *
20
- * | Option | Type | Default | Aliases |
21
- * |----------------|--------|-------------|--------------------------------------|
22
- * | items | array | [] | data, list, values, options, entries |
23
- * | listType | string | 'unordered' | type, ordered, ul, ol |
24
- * | selectionMode | string | 'none' | selection, mode, selectable |
25
- * | filterText | string | '' | filter, search, query, searchText |
26
- * | sorted | string | 'none' | sort, order, sortOrder, sortDirection|
27
- * | noItemsMessage | string | null | emptyMessage, emptyText, placeholder |
28
- * | columns | array | [] | cols, fields, headers |
29
- * | idField | string | '_juxId' | idKey, idProperty, keyField |
30
- *
31
- * METHODS (match state properties):
32
- * - .items(value) - Set list items
33
- * - .listType(type) - Set list type (ul/ol)
34
- * - .selectionMode(mode) - Set selection mode
35
- * - .filterText(text) - Set filter text
36
- * - .sorted(order) - Set sort order
37
- * - .noItemsMessage(msg) - Set empty state message
38
- * - .columns(cols) - Set column definitions
39
- *
40
- * CONVENIENCE ALIASES:
41
- * - .setSelectionMode(mode) → .selectionMode(mode)
42
- * - .setColumns(cols) → .columns(cols)
43
- * - .filter(text) → .filterText(text)
44
- * - .enableNoItems(msg) → .noItemsMessage(msg)
45
- * - .toggleSort(order?) → cycles/sets sorted state
46
- * - .toggleListType() → toggles listType state
47
- */
48
- export declare function List(id: string, options?: ListOptions): ListComponent;
49
- //# sourceMappingURL=List.d.ts.map
@@ -1,105 +0,0 @@
1
- import { ListEngine } from './ListEngine.js';
2
- import { ListSkin } from './ListSkin.js';
3
- /**
4
- * OPTIONS CONTRACT for List:
5
- *
6
- * | Option | Type | Default | Aliases |
7
- * |----------------|--------|-------------|--------------------------------------|
8
- * | items | array | [] | data, list, values, options, entries |
9
- * | listType | string | 'unordered' | type, ordered, ul, ol |
10
- * | selectionMode | string | 'none' | selection, mode, selectable |
11
- * | filterText | string | '' | filter, search, query, searchText |
12
- * | sorted | string | 'none' | sort, order, sortOrder, sortDirection|
13
- * | noItemsMessage | string | null | emptyMessage, emptyText, placeholder |
14
- * | columns | array | [] | cols, fields, headers |
15
- * | idField | string | '_juxId' | idKey, idProperty, keyField |
16
- *
17
- * METHODS (match state properties):
18
- * - .items(value) - Set list items
19
- * - .listType(type) - Set list type (ul/ol)
20
- * - .selectionMode(mode) - Set selection mode
21
- * - .filterText(text) - Set filter text
22
- * - .sorted(order) - Set sort order
23
- * - .noItemsMessage(msg) - Set empty state message
24
- * - .columns(cols) - Set column definitions
25
- *
26
- * CONVENIENCE ALIASES:
27
- * - .setSelectionMode(mode) → .selectionMode(mode)
28
- * - .setColumns(cols) → .columns(cols)
29
- * - .filter(text) → .filterText(text)
30
- * - .enableNoItems(msg) → .noItemsMessage(msg)
31
- * - .toggleSort(order?) → cycles/sets sorted state
32
- * - .toggleListType() → toggles listType state
33
- */
34
- export function List(id, options = {}) {
35
- // 1. Create the Logic
36
- const engine = new ListEngine(id, options);
37
- // Registration (Debug/Introspection)
38
- if (typeof window !== 'undefined') {
39
- // @ts-ignore
40
- window.juxEngines = window.juxEngines || {};
41
- // @ts-ignore
42
- window.juxEngines[id] = engine;
43
- // @ts-ignore
44
- window.juxEnginesKeys = Object.keys(window.juxEngines);
45
- }
46
- // 2. Create the View (wired to the engine)
47
- const skin = new ListSkin(engine);
48
- // 3. Augment the Engine with Render capability
49
- // @ts-ignore - Dynamic augmentation
50
- engine.render = (targetId) => {
51
- const target = typeof targetId === 'string'
52
- ? document.getElementById(targetId)
53
- : targetId;
54
- if (target) {
55
- skin.renderSkin(target);
56
- }
57
- else {
58
- console.warn(`Jux List: Target ${targetId} not found.`);
59
- }
60
- return engine; // Maintain Fluent Chain
61
- };
62
- // 4. Augment with Styling & UI capability
63
- // @ts-ignore
64
- engine.injectCSS = (id, cssContent) => skin.injectCSS(id, cssContent);
65
- // @ts-ignore
66
- engine.enableSearch = (enabled = true) => { skin.enableSearch(enabled); return engine; };
67
- // @ts-ignore
68
- engine.enableAdd = (enabled = true) => { skin.enableAdd(enabled); return engine; };
69
- // @ts-ignore
70
- engine.enableDelete = (enabled = true) => { skin.enableDelete(enabled); return engine; };
71
- // @ts-ignore
72
- engine.enableEdit = (enabled = true) => { skin.enableEdit(enabled); return engine; };
73
- // @ts-ignore
74
- engine.enableMove = (enabled = true) => { skin.enableMove(enabled); return engine; };
75
- // @ts-ignore
76
- engine.enableSort = (enabled = true) => { skin.enableSort(enabled); return engine; };
77
- // @ts-ignore
78
- engine.knobs = (features) => {
79
- features.forEach(k => {
80
- switch (k) {
81
- case 'add':
82
- skin.enableAdd(true);
83
- break;
84
- case 'edit':
85
- skin.enableEdit(true);
86
- break;
87
- case 'move':
88
- skin.enableMove(true);
89
- break;
90
- case 'search':
91
- skin.enableSearch(true);
92
- break;
93
- case 'delete':
94
- skin.enableDelete(true);
95
- break;
96
- case 'sort':
97
- skin.enableSort(true);
98
- break;
99
- }
100
- });
101
- return engine;
102
- };
103
- return engine;
104
- }
105
- //# sourceMappingURL=List.js.map
@@ -1,121 +0,0 @@
1
- import { BaseEngine, BaseState } from '../base/BaseEngine.js';
2
- import { OptionsContractSchema } from '../base/OptionsContract.js';
3
- export interface ListItem {
4
- id: string;
5
- text: string;
6
- selected: boolean;
7
- classes: string[];
8
- [key: string]: any;
9
- }
10
- /**
11
- * Flexible input shape for creating items
12
- * Allows simple strings or detailed configuration objects.
13
- */
14
- export type ListItemInput = string | Record<string, any>;
15
- export interface ListState extends BaseState {
16
- items: ListItem[];
17
- listType: 'unordered' | 'ordered';
18
- selectionMode: 'single' | 'multiple' | 'none';
19
- filterText: string;
20
- sorted: 'asc' | 'desc' | 'none';
21
- noItemsMessage: string | null;
22
- columns: (string | {
23
- key: string;
24
- label?: string;
25
- })[];
26
- idField: string;
27
- }
28
- export interface ListOptions {
29
- items?: ListItemInput[];
30
- listType?: 'unordered' | 'ordered';
31
- selectionMode?: 'single' | 'multiple' | 'none';
32
- filterText?: string;
33
- sorted?: 'asc' | 'desc' | 'none';
34
- noItemsMessage?: string | null;
35
- columns?: (string | {
36
- key: string;
37
- label?: string;
38
- })[];
39
- idField?: string;
40
- }
41
- export declare class ListEngine extends BaseEngine<ListState, ListOptions> {
42
- constructor(id: string, options?: ListOptions);
43
- /**
44
- * OPTIONS CONTRACT
45
- * Defines valid options with types, defaults, and aliases for common mistakes.
46
- */
47
- protected get optionsSchema(): OptionsContractSchema;
48
- /**
49
- * CONTRACT IMPLEMENTATION:
50
- * Convert loose Options into STRICT initial state.
51
- */
52
- protected prepareState(id: string, options: ListOptions): ListState;
53
- private static normalizeItem;
54
- /**
55
- * Set items array
56
- * Method name matches state property: items
57
- */
58
- items(value: ListItemInput[]): this;
59
- /**
60
- * Set list type
61
- * Method name matches state property: listType
62
- */
63
- listType(type: 'unordered' | 'ordered'): this;
64
- /**
65
- * Set selection mode
66
- * Method name matches state property: selectionMode
67
- */
68
- selectionMode(mode: 'single' | 'multiple' | 'none'): this;
69
- /**
70
- * Set filter text
71
- * Method name matches state property: filterText
72
- */
73
- filterText(text: string): this;
74
- /**
75
- * Set sort order
76
- * Method name matches state property: sorted
77
- */
78
- sorted(order: 'asc' | 'desc' | 'none'): this;
79
- /**
80
- * Set no items message
81
- * Method name matches state property: noItemsMessage
82
- */
83
- noItemsMessage(message: string | null): this;
84
- /**
85
- * Set columns configuration
86
- * Method name matches state property: columns
87
- */
88
- columns(cols: (string | {
89
- key: string;
90
- label?: string;
91
- })[]): this;
92
- /** @alias for selectionMode() */
93
- setSelectionMode(mode: 'single' | 'multiple' | 'none'): this;
94
- /** @alias for columns() */
95
- setColumns(cols: (string | {
96
- key: string;
97
- label?: string;
98
- })[]): this;
99
- /** @alias for filterText() */
100
- filter(text: string): this;
101
- /** @alias for noItemsMessage() */
102
- enableNoItems(message?: string): this;
103
- /**
104
- * Toggle sort order (cycles: none -> asc -> desc -> none)
105
- * @alias Convenience method that cycles sorted state
106
- */
107
- toggleSort(order?: 'asc' | 'desc' | 'none'): this;
108
- /**
109
- * Toggle list type between ordered/unordered
110
- * @alias Convenience method that toggles listType state
111
- */
112
- toggleListType(): this;
113
- addItem(input: ListItemInput): this;
114
- addItems(items: ListItemInput[]): this;
115
- clearItems(): this;
116
- removeItem(identifier: number | string): this;
117
- updateItem(index: number, updates: Partial<ListItem> | string): this;
118
- moveItem(fromIndex: number, toIndex: number): this;
119
- toggleSelection(index: number): this;
120
- }
121
- //# sourceMappingURL=ListEngine.d.ts.map