@lango-project/lango-client 0.2.0 → 0.4.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 +1 -0
- package/NOTICE +5 -1
- package/README.md +571 -855
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +112 -19
- package/cli/.lango/vendor/i18next.LICENSE +21 -0
- package/cli/.lango/vendor/i18next.mjs +2434 -0
- package/cli/create.mjs +62 -0
- package/cli/create.mjs.map +1 -0
- package/dist/.lango/localization.mjs +108 -0
- package/dist/.lango/runtime.mjs +112 -19
- package/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/dist/.lango/vendor/i18next.mjs +2434 -0
- package/dist/accordion.mjs +277 -0
- package/dist/accordion.mjs.map +1 -0
- package/dist/activities.mjs +185 -0
- package/dist/activities.mjs.map +1 -0
- package/dist/app.mjs +636 -0
- package/dist/app.mjs.map +1 -0
- package/dist/boot.mjs +24 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/bootstrap-LICENSE +21 -0
- package/dist/bootstrap.min.css +6 -0
- package/dist/bootstrap.min.css.map +1 -0
- package/dist/button.mjs +77 -0
- package/dist/button.mjs.map +1 -0
- package/dist/chip.mjs +134 -0
- package/dist/chip.mjs.map +1 -0
- package/dist/client.css +95 -0
- package/dist/collections.mjs +77 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/combo_box.mjs +408 -0
- package/dist/combo_box.mjs.map +1 -0
- package/dist/content.mjs +123 -0
- package/dist/content.mjs.map +1 -0
- package/dist/control.mjs +139 -0
- package/dist/control.mjs.map +1 -0
- package/dist/date_input.mjs +242 -0
- package/dist/date_input.mjs.map +1 -0
- package/dist/error_reporter.mjs +136 -0
- package/dist/error_reporter.mjs.map +1 -0
- package/dist/fields.mjs +454 -0
- package/dist/fields.mjs.map +1 -0
- package/dist/file_input.mjs +227 -0
- package/dist/file_input.mjs.map +1 -0
- package/dist/form.mjs +272 -0
- package/dist/form.mjs.map +1 -0
- package/dist/heartbeat.mjs +167 -254
- package/dist/heartbeat.mjs.map +1 -1
- package/dist/index.html +18 -0
- package/dist/indicators.mjs +127 -0
- package/dist/indicators.mjs.map +1 -0
- package/dist/input_changes.mjs +58 -0
- package/dist/input_changes.mjs.map +1 -0
- package/dist/input_group.mjs +38 -0
- package/dist/input_group.mjs.map +1 -0
- package/dist/layouts.mjs +195 -0
- package/dist/layouts.mjs.map +1 -0
- package/dist/library.mjs +130 -775
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +138 -0
- package/dist/main.mjs.map +1 -0
- package/dist/markdown.mjs +61 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/menus.mjs +468 -0
- package/dist/menus.mjs.map +1 -0
- package/dist/navigation.mjs +260 -410
- package/dist/navigation.mjs.map +1 -1
- package/dist/numeric_input.mjs +181 -0
- package/dist/numeric_input.mjs.map +1 -0
- package/dist/otp_input.mjs +113 -0
- package/dist/otp_input.mjs.map +1 -0
- package/dist/presentations.mjs +852 -0
- package/dist/presentations.mjs.map +1 -0
- package/dist/renderer.mjs +293 -0
- package/dist/renderer.mjs.map +1 -0
- package/dist/rich_content.mjs +99 -0
- package/dist/rich_content.mjs.map +1 -0
- package/dist/tables.mjs +369 -0
- package/dist/tables.mjs.map +1 -0
- package/dist/tabs.mjs +205 -0
- package/dist/tabs.mjs.map +1 -0
- package/dist/templates.mjs +46 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/vendor/DOMPurify-LICENSE +202 -0
- package/dist/vendor/dompurify.mjs +2540 -0
- package/dist/vendor/flatpickr-LICENSE.md +21 -0
- package/dist/vendor/flatpickr.min.css +13 -0
- package/dist/vendor/flatpickr.mjs +2340 -0
- package/dist/vendor/flatpickr.mjs.map +7 -0
- package/dist/vendor/marked-LICENSE.md +44 -0
- package/dist/vendor/marked.esm.js.map +7 -0
- package/dist/vendor/marked.mjs +85 -0
- package/dist/vendor/purify.es.mjs.map +1 -0
- package/dist/widgets.mjs +197 -0
- package/dist/widgets.mjs.map +1 -0
- package/docs/implementation.md +42 -0
- package/package.json +26 -40
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +508 -0
- package/src/boot.lango +12 -0
- package/src/button.lango +49 -0
- package/src/chip.lango +94 -0
- package/src/collections.lango +46 -0
- package/src/combo_box.lango +298 -0
- package/src/content.lango +75 -0
- package/src/control.lango +100 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -0
- package/src/error_reporter.lango +95 -0
- package/src/fields.lango +327 -0
- package/src/file_input.lango +175 -0
- package/src/form.lango +195 -0
- package/src/heartbeat.lango +136 -199
- package/src/indicators.lango +94 -0
- package/src/input_changes.lango +33 -0
- package/src/input_group.lango +22 -0
- package/src/layouts.lango +137 -0
- package/src/library.lango +194 -571
- package/src/longpoll.lango +187 -0
- package/src/main.lango +109 -0
- package/src/markdown.lango +48 -0
- package/src/menus.lango +336 -0
- package/src/navigation.lango +209 -299
- package/src/numeric_input.lango +131 -0
- package/src/otp_input.lango +83 -0
- package/src/presentations.lango +617 -0
- package/src/renderer.lango +288 -0
- package/src/rich_content.lango +66 -0
- package/src/tables.lango +271 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +95 -0
- package/web/index.html +18 -0
- package/dist/application.mjs +0 -429
- package/dist/application.mjs.map +0 -1
- package/dist/coordinator.mjs +0 -91
- package/dist/coordinator.mjs.map +0 -1
- package/dist/demo.mjs +0 -110
- package/dist/demo.mjs.map +0 -1
- package/dist/demo_controls.mjs +0 -59
- package/dist/demo_controls.mjs.map +0 -1
- package/dist/errors.mjs +0 -201
- package/dist/errors.mjs.map +0 -1
- package/dist/form_state.mjs +0 -266
- package/dist/form_state.mjs.map +0 -1
- package/dist/inheritance.mjs +0 -240
- package/dist/inheritance.mjs.map +0 -1
- package/dist/input_values.mjs +0 -65
- package/dist/input_values.mjs.map +0 -1
- package/dist/node/.lango/xmldom/conventions.js +0 -429
- package/dist/node/.lango/xmldom/dom-parser.js +0 -591
- package/dist/node/.lango/xmldom/dom.js +0 -3759
- package/dist/node/.lango/xmldom/entities.js +0 -2171
- package/dist/node/.lango/xmldom/errors.js +0 -205
- package/dist/node/.lango/xmldom/grammar.js +0 -559
- package/dist/node/.lango/xmldom/index.js +0 -41
- package/dist/node/.lango/xmldom/package.json +0 -1
- package/dist/node/.lango/xmldom/sax.js +0 -983
- package/dist/node/.lango/xmldom.LICENSE.md +0 -8
- package/dist/node/browser_host.mjs +0 -351
- package/dist/node/browser_host.mjs.map +0 -1
- package/dist/node/create_app.mjs +0 -118
- package/dist/node/create_app.mjs.map +0 -1
- package/dist/presentation.mjs +0 -89
- package/dist/presentation.mjs.map +0 -1
- package/dist/protocol.mjs +0 -706
- package/dist/protocol.mjs.map +0 -1
- package/dist/session.mjs +0 -431
- package/dist/session.mjs.map +0 -1
- package/dist/tokens.mjs +0 -298
- package/dist/tokens.mjs.map +0 -1
- package/examples/contacts.lango +0 -302
- package/examples/contacts_flow.lango +0 -174
- package/examples/contacts_store.lango +0 -109
- package/examples/contacts_store_test.lango +0 -65
- package/examples/demo.css +0 -72
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -28
- package/examples/pages.lango +0 -180
- package/examples/server.lango +0 -189
- package/examples/worker.lango +0 -142
- package/src/application.lango +0 -327
- package/src/browser_host.lango +0 -276
- package/src/coordinator.lango +0 -57
- package/src/demo.lango +0 -110
- package/src/demo_controls.lango +0 -53
- package/src/errors.lango +0 -149
- package/src/errors_test.lango +0 -157
- package/src/form_state.lango +0 -168
- package/src/heartbeat_test.lango +0 -479
- package/src/inheritance.lango +0 -167
- package/src/input_values.lango +0 -37
- package/src/logout_test.lango +0 -564
- package/src/navigation_test.lango +0 -556
- package/src/presentation.lango +0 -55
- package/src/protocol.lango +0 -787
- package/src/renderer_test.lango +0 -1986
- package/src/session.lango +0 -313
- package/src/session_test.lango +0 -455
- package/src/tabs_test.lango +0 -216
- package/src/tokens.lango +0 -215
- package/template/.vscode/extensions.json +0 -3
- package/template/.vscode/settings.json +0 -9
- package/template/README.md +0 -40
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -4
- package/template/public/index.html +0 -24
- package/template/src/client.lango +0 -78
- package/template/src/pages.lango +0 -55
- package/template/src/server.lango +0 -24
- package/template/src/worker.lango +0 -77
- package/template/test/app.lango +0 -9
- package/tools/create_app.lango +0 -88
- package/tools/create_app_test.lango +0 -43
- package/tools/starter_test.lango +0 -227
- /package/{dist/node → cli}/.lango/bignumber.mjs +0 -0
- /package/{dist → cli}/.lango/xmldom/conventions.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom-parser.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom.js +0 -0
- /package/{dist → cli}/.lango/xmldom/entities.js +0 -0
- /package/{dist → cli}/.lango/xmldom/errors.js +0 -0
- /package/{dist → cli}/.lango/xmldom/grammar.js +0 -0
- /package/{dist → cli}/.lango/xmldom/index.js +0 -0
- /package/{dist → cli}/.lango/xmldom/package.json +0 -0
- /package/{dist → cli}/.lango/xmldom/sax.js +0 -0
- /package/{dist → cli}/.lango/xmldom.LICENSE.md +0 -0
package/dist/inheritance.mjs
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fromJson as __fromJson,
|
|
3
|
-
toJson as __toJson,
|
|
4
|
-
isNumber as __isNumber,
|
|
5
|
-
isString as __isString,
|
|
6
|
-
isBool as __isBool,
|
|
7
|
-
isObject as __isObject,
|
|
8
|
-
isArray as __isArray,
|
|
9
|
-
entries as __entries,
|
|
10
|
-
add as __add,
|
|
11
|
-
requireBoolean as __requireBoolean,
|
|
12
|
-
normalize as __normalize,
|
|
13
|
-
finite as __finite,
|
|
14
|
-
boundary as __boundary,
|
|
15
|
-
requireArity as __requireArity,
|
|
16
|
-
} from "./.lango/runtime.mjs";
|
|
17
|
-
|
|
18
|
-
class InheritedValue {
|
|
19
|
-
name;
|
|
20
|
-
controls;
|
|
21
|
-
inherited;
|
|
22
|
-
writable;
|
|
23
|
-
#source;
|
|
24
|
-
constructor(name, source, writable) {
|
|
25
|
-
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
26
|
-
name = __boundary(name);
|
|
27
|
-
source = __boundary(source);
|
|
28
|
-
writable = __boundary(writable);
|
|
29
|
-
this.name = name;
|
|
30
|
-
this.#source = source;
|
|
31
|
-
this.inherited = true;
|
|
32
|
-
this.writable = writable;
|
|
33
|
-
this.controls = null;
|
|
34
|
-
if (__requireBoolean(source.element.langoFormRoot === true)) {
|
|
35
|
-
throw "UiInheritanceCrossesFormBoundary";
|
|
36
|
-
}
|
|
37
|
-
if (__requireBoolean(__isArray(__normalize(source.controls)))) {
|
|
38
|
-
this.controls = [];
|
|
39
|
-
for (const child of __normalize(source.controls)) {
|
|
40
|
-
this.controls.push(new InheritedValue(__normalize(child.name), child, writable));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
getValue() {
|
|
45
|
-
return __fromJson(__toJson(__normalize(this.#source.getValue())));
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
setValue(value) {
|
|
49
|
-
__requireArity(arguments.length, [0], "setValue");
|
|
50
|
-
value = __boundary(value);
|
|
51
|
-
if (__requireBoolean(!__requireBoolean(__normalize(this.writable)))) {
|
|
52
|
-
throw "UiInheritedValueReadOnly";
|
|
53
|
-
}
|
|
54
|
-
__normalize(this.#source.setValue(__fromJson(__toJson(value))));
|
|
55
|
-
return null;
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
snapshotState() {
|
|
59
|
-
if (__requireBoolean(__normalize(this.#source.snapshotState) !== null)) {
|
|
60
|
-
return { custom: true, value: __normalize(this.#source.snapshotState()) };
|
|
61
|
-
}
|
|
62
|
-
return { custom: false, value: this.getValue() };
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
restoreState(snapshot) {
|
|
66
|
-
__requireArity(arguments.length, [0], "restoreState");
|
|
67
|
-
snapshot = __boundary(snapshot);
|
|
68
|
-
if (__requireBoolean(__normalize(snapshot.custom))) {
|
|
69
|
-
return __normalize(this.#source.restoreState(__normalize(snapshot.value)));
|
|
70
|
-
}
|
|
71
|
-
return this.setValue(__normalize(snapshot.value));
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
isDirty() {
|
|
75
|
-
if (__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(this.writable))) || __requireBoolean(__normalize(this.#source.isDirty) === null))) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
return __normalize(this.#source.isDirty());
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
validate() {
|
|
82
|
-
if (__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(this.writable))) || __requireBoolean(__normalize(this.#source.validate) === null))) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#source.element.disabled) === true) || __requireBoolean(__normalize(this.#source.element.hidden) === true)) || __requireBoolean(__normalize(this.#source.element.inert) === true))) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
return __normalize(this.#source.validate());
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
reportValidity() {
|
|
92
|
-
if (__requireBoolean(__normalize(this.#source.reportValidity) !== null)) {
|
|
93
|
-
return __normalize(this.#source.reportValidity());
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
reportPendingError() {
|
|
99
|
-
if (__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(this.writable))) || __requireBoolean(__normalize(this.#source.reportPendingError) === null))) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
return __normalize(this.#source.reportPendingError());
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
applyProperty(name, value) {
|
|
106
|
-
__requireArity(arguments.length, [0, 1], "applyProperty");
|
|
107
|
-
name = __boundary(name);
|
|
108
|
-
value = __boundary(value);
|
|
109
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__normalize(this.writable))) || __requireBoolean(__requireBoolean(name !== "savedValue") && __requireBoolean(name !== "error"))) || __requireBoolean(__normalize(this.#source.applyProperty) === null))) {
|
|
110
|
-
throw "UiInheritedCommandNotAllowed";
|
|
111
|
-
}
|
|
112
|
-
return __normalize(this.#source.applyProperty(name, value));
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function validName(name) {
|
|
117
|
-
__requireArity(arguments.length, [0], "validName");
|
|
118
|
-
name = __boundary(name);
|
|
119
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__isString(name))) || __requireBoolean(name === "")) || __requireBoolean(name === "__proto__")) || __requireBoolean(name === "constructor")) || __requireBoolean(name === "prototype")) || __requireBoolean(name === "value")) || __requireBoolean(name === "then"))) {
|
|
120
|
-
throw "UiInvalidInheritedName";
|
|
121
|
-
}
|
|
122
|
-
return null;
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function normalizeInheritance(spec) {
|
|
127
|
-
__requireArity(arguments.length, [0], "normalizeInheritance");
|
|
128
|
-
spec = __boundary(spec);
|
|
129
|
-
let result = { };
|
|
130
|
-
if (__requireBoolean(spec === null)) {
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
if (__requireBoolean(!__requireBoolean(__isObject(spec)))) {
|
|
134
|
-
throw "UiInheritanceMustBeMap";
|
|
135
|
-
}
|
|
136
|
-
for (const [alias, entry] of __entries(spec)) {
|
|
137
|
-
validName(alias);
|
|
138
|
-
let path = entry;
|
|
139
|
-
let writable = false;
|
|
140
|
-
if (__requireBoolean(__isObject(entry))) {
|
|
141
|
-
for (const [name, value] of __entries(entry)) {
|
|
142
|
-
if (__requireBoolean(__requireBoolean(name !== "path") && __requireBoolean(name !== "writable"))) {
|
|
143
|
-
throw "UiUnknownInheritanceOption";
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
path = __normalize(entry.path);
|
|
147
|
-
if (__requireBoolean(__normalize(entry.writable) !== null)) {
|
|
148
|
-
if (__requireBoolean(!__requireBoolean(__isBool(__normalize(entry.writable))))) {
|
|
149
|
-
throw "UiInheritanceWritableMustBeBoolean";
|
|
150
|
-
}
|
|
151
|
-
writable = __normalize(entry.writable);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (__requireBoolean(__isString(path))) {
|
|
155
|
-
path = [path];
|
|
156
|
-
}
|
|
157
|
-
if (__requireBoolean(__requireBoolean(!__requireBoolean(__isArray(path))) || __requireBoolean(__normalize(path.length) === 0))) {
|
|
158
|
-
throw "UiInheritanceRequiresPath";
|
|
159
|
-
}
|
|
160
|
-
for (const name of path) {
|
|
161
|
-
validName(name);
|
|
162
|
-
}
|
|
163
|
-
result[alias] = { path: __normalize(path.slice()), writable: writable };
|
|
164
|
-
}
|
|
165
|
-
return result;
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function inheritedControls(form, parent) {
|
|
170
|
-
__requireArity(arguments.length, [0, 1], "inheritedControls");
|
|
171
|
-
form = __boundary(form);
|
|
172
|
-
parent = __boundary(parent);
|
|
173
|
-
let result = __normalize(form.controls.slice());
|
|
174
|
-
for (const [alias, entry] of __entries(__normalize(form.inherit))) {
|
|
175
|
-
if (__requireBoolean(parent === null)) {
|
|
176
|
-
throw "UiInheritanceRequiresParentForm";
|
|
177
|
-
}
|
|
178
|
-
for (const control of __normalize(form.controls)) {
|
|
179
|
-
if (__requireBoolean(__normalize(control.name) === alias)) {
|
|
180
|
-
throw `UiInheritedNameCollision: ${alias}`;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
let source = findSource(__normalize(parent.controls), __normalize(entry.path));
|
|
184
|
-
__add(result, new InheritedValue(alias, source, __normalize(entry.writable)));
|
|
185
|
-
}
|
|
186
|
-
return result;
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function findSource(controls, path) {
|
|
191
|
-
__requireArity(arguments.length, [0, 1], "findSource");
|
|
192
|
-
controls = __boundary(controls);
|
|
193
|
-
path = __boundary(path);
|
|
194
|
-
let current = controls;
|
|
195
|
-
let target = null;
|
|
196
|
-
for (const [index, name] of __entries(path)) {
|
|
197
|
-
target = null;
|
|
198
|
-
for (const control of current) {
|
|
199
|
-
if (__requireBoolean(__normalize(control.name) === name)) {
|
|
200
|
-
target = control;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (__requireBoolean(target === null)) {
|
|
204
|
-
throw `UiInheritedSourceNotFound: ${name}`;
|
|
205
|
-
}
|
|
206
|
-
if (__requireBoolean(target.element.langoFormRoot === true)) {
|
|
207
|
-
throw "UiInheritanceCrossesFormBoundary";
|
|
208
|
-
}
|
|
209
|
-
if (__requireBoolean(index < __finite(__normalize(path.length) - 1))) {
|
|
210
|
-
current = __normalize(target.controls);
|
|
211
|
-
if (__requireBoolean(!__requireBoolean(__isArray(current)))) {
|
|
212
|
-
throw "UiInheritedSourceIsNotContainer";
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return target;
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export function inheritanceResources(path, parentPath, spec) {
|
|
221
|
-
__requireArity(arguments.length, [0, 1, 2], "inheritanceResources");
|
|
222
|
-
path = __boundary(path);
|
|
223
|
-
parentPath = __boundary(parentPath);
|
|
224
|
-
spec = __boundary(spec);
|
|
225
|
-
let reads = [];
|
|
226
|
-
let writes = [path];
|
|
227
|
-
for (const [alias, entry] of __entries(spec)) {
|
|
228
|
-
if (__requireBoolean(parentPath === null)) {
|
|
229
|
-
throw "UiInheritanceRequiresParentForm";
|
|
230
|
-
}
|
|
231
|
-
let source = __normalize(parentPath.concat(__normalize(entry.path)));
|
|
232
|
-
reads.push(source);
|
|
233
|
-
if (__requireBoolean(__normalize(entry.writable))) {
|
|
234
|
-
writes.push(source);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return { reads: reads, writes: writes };
|
|
238
|
-
return null;
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=inheritance.mjs.map
|
package/dist/inheritance.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inheritance.mjs","sources":["inheritance.lango"],"sourcesContent":["export normalizeInheritance(spec)\nexport inheritedControls(form, parent)\nexport inheritanceResources(path, parentPath, spec)\n\nvalidName(name)\n if !is_string(name) or name == \"\" or name == \"__proto__\" or name == \"constructor\" or name == \"prototype\" or name == \"value\" or name == \"then\"\n throw \"UiInvalidInheritedName\"\n return null\n\nnormalizeInheritance(spec)\n result = {\n }\n if spec == null\n return result\n if !is_object(spec)\n throw \"UiInheritanceMustBeMap\"\n for spec as alias: entry\n validName(alias)\n path = entry\n writable = false\n if is_object(entry)\n for entry as name: value\n if name != \"path\" and name != \"writable\"\n throw \"UiUnknownInheritanceOption\"\n path = entry.path\n if entry.writable != null\n if !is_bool(entry.writable)\n throw \"UiInheritanceWritableMustBeBoolean\"\n writable = entry.writable\n if is_string(path)\n path = [path]\n if !is_array(path) or path.length == 0\n throw \"UiInheritanceRequiresPath\"\n for path as name\n validName(name)\n result[alias] = {\n path: path.slice()\n writable: writable\n }\n return result\n\ninheritedControls(form, parent)\n result = form.controls.slice()\n for form.inherit as alias: entry\n if parent == null\n throw \"UiInheritanceRequiresParentForm\"\n for form.controls as control\n if control.name == alias\n throw \"UiInheritedNameCollision: ${alias}\"\n source = findSource(parent.controls, entry.path)\n result.add(new InheritedValue(alias, source, entry.writable))\n return result\n\nfindSource(controls, path)\n current = controls\n target = null\n for path as index: name\n target = null\n for current as control\n if control.name == name\n target = control\n if target == null\n throw \"UiInheritedSourceNotFound: ${name}\"\n if target.element.langoFormRoot == true\n throw \"UiInheritanceCrossesFormBoundary\"\n if index < path.length - 1\n current = target.controls\n if !is_array(current)\n throw \"UiInheritedSourceIsNotContainer\"\n return target\n\ninheritanceResources(path, parentPath, spec)\n reads = []\n writes = [path]\n for spec as alias: entry\n if parentPath == null\n throw \"UiInheritanceRequiresParentForm\"\n source = parentPath.concat(entry.path)\n reads.add(source)\n if entry.writable\n writes.add(source)\n return {\n reads: reads\n writes: writes\n }\n\nclass InheritedValue\n properties\n name\n controls\n inherited\n writable\n methods\n getValue()\n setValue(value)\n snapshotState()\n restoreState(snapshot)\n isDirty()\n validate()\n reportValidity()\n reportPendingError()\n applyProperty(name, value)\n\nInheritedValue(name, source, writable)\n @name = name\n @source = source\n @inherited = true\n @writable = writable\n @controls = null\n if source.element.langoFormRoot == true\n throw \"UiInheritanceCrossesFormBoundary\"\n if is_array(source.controls)\n @controls = []\n for source.controls as child\n @controls.add(new InheritedValue(child.name, child, writable))\n\nInheritedValue:getValue()\n return from_json(to_json(@source.getValue()))\n\nInheritedValue:setValue(value)\n if !@writable\n throw \"UiInheritedValueReadOnly\"\n @source.setValue(from_json(to_json(value)))\n return null\n\nInheritedValue:snapshotState()\n if @source.snapshotState != null\n return {\n custom: true\n value: @source.snapshotState()\n }\n return {\n custom: false\n value: getValue()\n }\n\nInheritedValue:restoreState(snapshot)\n if snapshot.custom\n return @source.restoreState(snapshot.value)\n return setValue(snapshot.value)\n\nInheritedValue:isDirty()\n if !@writable or @source.isDirty == null\n return false\n return @source.isDirty()\n\nInheritedValue:validate()\n if !@writable or @source.validate == null\n return null\n if @source.element.disabled == true or @source.element.hidden == true or @source.element.inert == true\n return null\n return @source.validate()\n\nInheritedValue:reportValidity()\n if @source.reportValidity != null\n return @source.reportValidity()\n return true\n\nInheritedValue:reportPendingError()\n if !@writable or @source.reportPendingError == null\n return false\n return @source.reportPendingError()\n\nInheritedValue:applyProperty(name, value)\n if !@writable or (name != \"savedValue\" and name != \"error\") or @source.applyProperty == null\n throw \"UiInheritedCommandNotAllowed\"\n return @source.applyProperty(name, value)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAsFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAlFA;;;;;;;;;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/input_values.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isNumber as __isNumber,
|
|
3
|
-
isString as __isString,
|
|
4
|
-
isBool as __isBool,
|
|
5
|
-
isObject as __isObject,
|
|
6
|
-
isArray as __isArray,
|
|
7
|
-
entries as __entries,
|
|
8
|
-
requireBoolean as __requireBoolean,
|
|
9
|
-
normalize as __normalize,
|
|
10
|
-
finite as __finite,
|
|
11
|
-
boundary as __boundary,
|
|
12
|
-
requireArity as __requireArity,
|
|
13
|
-
} from "./.lango/runtime.mjs";
|
|
14
|
-
|
|
15
|
-
export function selectItems(options) {
|
|
16
|
-
__requireArity(arguments.length, [0], "selectItems");
|
|
17
|
-
options = __boundary(options);
|
|
18
|
-
if (__requireBoolean(options === null)) {
|
|
19
|
-
return [];
|
|
20
|
-
}
|
|
21
|
-
if (__requireBoolean(!__requireBoolean(__isArray(options)))) {
|
|
22
|
-
throw "UiSelectOptionsMustBeArray";
|
|
23
|
-
}
|
|
24
|
-
let items = [];
|
|
25
|
-
let values = [];
|
|
26
|
-
for (const option of options) {
|
|
27
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(option))) || __requireBoolean(!__requireBoolean(__isString(__normalize(option.value))))) || __requireBoolean(!__requireBoolean(__isString(__normalize(option.text)))))) {
|
|
28
|
-
throw "UiSelectOptionRequiresValueAndText";
|
|
29
|
-
}
|
|
30
|
-
if (__requireBoolean(__normalize(values.includes(__normalize(option.value))))) {
|
|
31
|
-
throw "UiSelectDuplicateValue";
|
|
32
|
-
}
|
|
33
|
-
let disabled = __normalize(option.disabled);
|
|
34
|
-
if (__requireBoolean(disabled === null)) {
|
|
35
|
-
disabled = false;
|
|
36
|
-
}
|
|
37
|
-
if (__requireBoolean(!__requireBoolean(__isBool(disabled)))) {
|
|
38
|
-
throw "UiSelectOptionDisabledMustBeBoolean";
|
|
39
|
-
}
|
|
40
|
-
values.push(__normalize(option.value));
|
|
41
|
-
items.push({ value: __normalize(option.value), text: __normalize(option.text), disabled: disabled });
|
|
42
|
-
}
|
|
43
|
-
return items;
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function selectIndex(items, value) {
|
|
48
|
-
__requireArity(arguments.length, [0, 1], "selectIndex");
|
|
49
|
-
items = __boundary(items);
|
|
50
|
-
value = __boundary(value);
|
|
51
|
-
if (__requireBoolean(value === null)) {
|
|
52
|
-
return __finite(-1);
|
|
53
|
-
}
|
|
54
|
-
if (__requireBoolean(!__requireBoolean(__isString(value)))) {
|
|
55
|
-
throw "UiSelectValueMustBeStringOrNull";
|
|
56
|
-
}
|
|
57
|
-
for (const [index, item] of __entries(items)) {
|
|
58
|
-
if (__requireBoolean(__normalize(item.value) === value)) {
|
|
59
|
-
return index;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
throw "UiSelectValueNotInOptions";
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=input_values.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input_values.mjs","sources":["input_values.lango"],"sourcesContent":["export selectItems(options)\nexport selectIndex(items, value)\n\nselectItems(options)\n if options == null\n return []\n if !is_array(options)\n throw \"UiSelectOptionsMustBeArray\"\n items = []\n values = []\n for options as option\n if !is_object(option) or !is_string(option.value) or !is_string(option.text)\n throw \"UiSelectOptionRequiresValueAndText\"\n if values.includes(option.value)\n throw \"UiSelectDuplicateValue\"\n disabled = option.disabled\n if disabled == null\n disabled = false\n if !is_bool(disabled)\n throw \"UiSelectOptionDisabledMustBeBoolean\"\n values.add(option.value)\n items.add({\n value: option.value\n text: option.text\n disabled: disabled\n })\n return items\n\nselectIndex(items, value)\n if value == null\n return -1\n if !is_string(value)\n throw \"UiSelectValueMustBeStringOrNull\"\n for items as index: item\n if item.value == value\n return index\n throw \"UiSelectValueNotInOptions\"\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA;;;;;;;;;;;;;;;;;;;"}
|