@optionfactory/fml 8.0.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.md +21 -0
- package/README.md +22 -0
- package/dist/client-errors.iife.js +109 -0
- package/dist/client-errors.iife.js.map +1 -0
- package/dist/client-errors.iife.min.js +2 -0
- package/dist/client-errors.iife.min.js.map +1 -0
- package/dist/fml.css +2 -0
- package/dist/fml.css.map +1 -0
- package/dist/fml.d.mts +1241 -0
- package/dist/fml.iife.js +8340 -0
- package/dist/fml.iife.js.map +1 -0
- package/dist/fml.iife.min.js +2 -0
- package/dist/fml.iife.min.js.map +1 -0
- package/dist/fml.min.mjs +2 -0
- package/dist/fml.min.mjs.map +1 -0
- package/dist/fml.mjs +8284 -0
- package/dist/fml.mjs.map +1 -0
- package/dist/ftl.d.mts +361 -0
- package/dist/ftl.iife.js +4719 -0
- package/dist/ftl.iife.js.map +1 -0
- package/dist/ftl.iife.min.js +2 -0
- package/dist/ftl.iife.min.js.map +1 -0
- package/dist/ftl.min.mjs +2 -0
- package/dist/ftl.min.mjs.map +1 -0
- package/dist/ftl.mjs +4700 -0
- package/dist/ftl.mjs.map +1 -0
- package/dist/ful.css +2 -0
- package/dist/ful.css.map +1 -0
- package/dist/ful.d.mts +581 -0
- package/dist/ful.iife.js +2814 -0
- package/dist/ful.iife.js.map +1 -0
- package/dist/ful.iife.min.js +2 -0
- package/dist/ful.iife.min.js.map +1 -0
- package/dist/ful.min.mjs +2 -0
- package/dist/ful.min.mjs.map +1 -0
- package/dist/ful.mjs +2780 -0
- package/dist/ful.mjs.map +1 -0
- package/dist/httpc.d.mts +306 -0
- package/dist/httpc.iife.js +755 -0
- package/dist/httpc.iife.js.map +1 -0
- package/dist/httpc.iife.min.js +2 -0
- package/dist/httpc.iife.min.js.map +1 -0
- package/dist/httpc.min.mjs +2 -0
- package/dist/httpc.min.mjs.map +1 -0
- package/dist/httpc.mjs +743 -0
- package/dist/httpc.mjs.map +1 -0
- package/package.json +72 -0
package/dist/ftl.d.mts
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
declare class Expressions {
|
|
2
|
+
#private;
|
|
3
|
+
static MODE_EXPRESSION: symbol;
|
|
4
|
+
static MODE_TEMPLATED: symbol;
|
|
5
|
+
/**
|
|
6
|
+
* Parses an expression.
|
|
7
|
+
* @param {string} expression
|
|
8
|
+
* @param {(typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED)?} [mode]
|
|
9
|
+
* @returns the ast
|
|
10
|
+
*/
|
|
11
|
+
static parse(expression: string, mode?: (typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED) | null): any;
|
|
12
|
+
/**
|
|
13
|
+
* Evaluates an expression.
|
|
14
|
+
* @param {{[k: string]: any } | null | undefined } modules
|
|
15
|
+
* @param {any[]} dataStack
|
|
16
|
+
* @param {any} ast
|
|
17
|
+
* @param {(typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED)?} [mode]
|
|
18
|
+
* @returns the result
|
|
19
|
+
*/
|
|
20
|
+
static evaluate(modules: {
|
|
21
|
+
[k: string]: any;
|
|
22
|
+
} | null | undefined, dataStack: any[], ast: any, mode?: (typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED) | null): any;
|
|
23
|
+
/**
|
|
24
|
+
* Parses and evaluates an expression.
|
|
25
|
+
* @param {{ [x: string]: any; } | null | undefined} modules
|
|
26
|
+
* @param {any[]} dataStack
|
|
27
|
+
* @param {string} expression
|
|
28
|
+
* @param {(typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED)?} [mode]
|
|
29
|
+
* @returns the result
|
|
30
|
+
*/
|
|
31
|
+
static interpret(modules: {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
} | null | undefined, dataStack: any[], expression: string, mode?: (typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED) | null): any;
|
|
34
|
+
}
|
|
35
|
+
declare class ExpressionEvaluator {
|
|
36
|
+
#private;
|
|
37
|
+
constructor(modules: any, dataStack: any);
|
|
38
|
+
withModule(name: any, value: any): ExpressionEvaluator;
|
|
39
|
+
withOverlay(...data: any[]): ExpressionEvaluator;
|
|
40
|
+
evaluate(expression: any, mode: any): any;
|
|
41
|
+
evaluateExpression(expression: any): any;
|
|
42
|
+
evaluateTemplated(expression: any): any;
|
|
43
|
+
}
|
|
44
|
+
declare class Fragments {
|
|
45
|
+
/**
|
|
46
|
+
* Creates a DocumentFragment from an string.
|
|
47
|
+
* @param {...string} html
|
|
48
|
+
* @returns {DocumentFragment} the fragment
|
|
49
|
+
*/
|
|
50
|
+
static fromHtml(...html: string[]): DocumentFragment;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a string representation (HTML) of a DocumentFragment.
|
|
53
|
+
* @param {DocumentFragment} fragment
|
|
54
|
+
* @returns {string} the html
|
|
55
|
+
*/
|
|
56
|
+
static toHtml(fragment: DocumentFragment): string;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a fragment contains only blank text nodes
|
|
59
|
+
* @param {DocumentFragment} fragment
|
|
60
|
+
* @returns {boolean} true if the fragment is blank
|
|
61
|
+
*/
|
|
62
|
+
static isBlank(fragment: DocumentFragment): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a DocumentFragment from nodes.
|
|
65
|
+
* @param {...Node} nodes
|
|
66
|
+
* @returns {DocumentFragment} the fragment
|
|
67
|
+
*/
|
|
68
|
+
static from(...nodes: Node[]): DocumentFragment;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a DocumentFragment from childNodes of an element.
|
|
71
|
+
* @param {Node} el
|
|
72
|
+
* @returns {DocumentFragment} the fragment
|
|
73
|
+
*/
|
|
74
|
+
static fromChildNodes(el: Node): DocumentFragment;
|
|
75
|
+
}
|
|
76
|
+
declare class Attributes {
|
|
77
|
+
static id: number;
|
|
78
|
+
/**
|
|
79
|
+
* Creates a unique id with the given prefix.
|
|
80
|
+
* @param {string} prefix
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
static uid(prefix: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Sets an attribute if not present.
|
|
86
|
+
* @param {Element} el
|
|
87
|
+
* @param {string} k
|
|
88
|
+
* @param {string} v
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
static defaultValue(el: Element, k: string, v: string): string | null;
|
|
92
|
+
/**
|
|
93
|
+
* Forwards prefixed attributes from an element to another (removing the prefix).
|
|
94
|
+
* @param {string} prefix
|
|
95
|
+
* @param {Element} from
|
|
96
|
+
* @param {Element} to
|
|
97
|
+
*/
|
|
98
|
+
static forward(prefix: string, from: Element, to: Element): void;
|
|
99
|
+
/**
|
|
100
|
+
* Changes the presence of an attribute.
|
|
101
|
+
* @param {Element} el
|
|
102
|
+
* @param {string} attr
|
|
103
|
+
* @param {boolean} value
|
|
104
|
+
*/
|
|
105
|
+
static toggle(el: Element, attr: string, value: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* Changes the presence of an attribute based on its current state.
|
|
108
|
+
* @param {Element} el
|
|
109
|
+
* @param {string} attr
|
|
110
|
+
*/
|
|
111
|
+
static flip(el: Element, attr: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* Sets the value of an attribute. nullish values remove the attribute.
|
|
114
|
+
* @param {Element} el
|
|
115
|
+
* @param {string} attr
|
|
116
|
+
* @param {string | null | undefined} value
|
|
117
|
+
*/
|
|
118
|
+
static set(el: Element, attr: string, value: string | null | undefined): void;
|
|
119
|
+
}
|
|
120
|
+
declare class LightSlots {
|
|
121
|
+
/**
|
|
122
|
+
* Extracts light slots from an element. For non default slots in a template tag, the content is extracted.
|
|
123
|
+
* @param {Element} el
|
|
124
|
+
* @returns the slots
|
|
125
|
+
*/
|
|
126
|
+
static from(el: Element): {
|
|
127
|
+
default: DocumentFragment;
|
|
128
|
+
};
|
|
129
|
+
static slotFromNode(el: any): any;
|
|
130
|
+
}
|
|
131
|
+
declare class Nodes {
|
|
132
|
+
/**
|
|
133
|
+
* Checks if an element is already parsed.
|
|
134
|
+
* @param {Element} el
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
static isParsed(el: Element): boolean;
|
|
138
|
+
static waitParsed(el: any): Promise<any>;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the first child of the element element (if exists) matching the selector.
|
|
141
|
+
* @param {Element} el
|
|
142
|
+
* @param {string} selector
|
|
143
|
+
* @returns
|
|
144
|
+
*/
|
|
145
|
+
static queryChildren(el: Element, selector: string): Element | null;
|
|
146
|
+
/**
|
|
147
|
+
* Returns all children of the element matching the selector.
|
|
148
|
+
* @param {Element} el
|
|
149
|
+
* @param {string} selector
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
static queryChildrenAll(el: Element, selector: string): Element[];
|
|
153
|
+
}
|
|
154
|
+
declare class Template {
|
|
155
|
+
#private;
|
|
156
|
+
/**
|
|
157
|
+
* Creates a template from a string.
|
|
158
|
+
* @param {string} html
|
|
159
|
+
* @param {{ [k: string] : any }?} [modules]
|
|
160
|
+
* @param {...*} data
|
|
161
|
+
* @returns the template
|
|
162
|
+
*/
|
|
163
|
+
static fromHtml(html: string, modules?: {
|
|
164
|
+
[k: string]: any;
|
|
165
|
+
} | null, ...data: any[]): Template;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a template from the content of the first template element matching the selector.
|
|
168
|
+
* @param {string} selector for an HTMLTemplateElement
|
|
169
|
+
* @param {{ [k: string] : any }?} [modules]
|
|
170
|
+
* @param {...*} data
|
|
171
|
+
* @returns the template
|
|
172
|
+
*/
|
|
173
|
+
static fromSelector(selector: string, modules?: {
|
|
174
|
+
[k: string]: any;
|
|
175
|
+
} | null, ...data: any[]): Template;
|
|
176
|
+
/**
|
|
177
|
+
* Creates a template from the content of an HTMLTemplateElement.
|
|
178
|
+
* @param {HTMLTemplateElement} templateEl
|
|
179
|
+
* @param {{ [k: string] : any }?} [modules]
|
|
180
|
+
* @param {...*} data
|
|
181
|
+
* @returns the template
|
|
182
|
+
*/
|
|
183
|
+
static fromTemplate(templateEl: HTMLTemplateElement, modules?: {
|
|
184
|
+
[k: string]: any;
|
|
185
|
+
} | null, ...data: any[]): Template;
|
|
186
|
+
/**
|
|
187
|
+
* Creates a template from a DocumentFragment.
|
|
188
|
+
* @param {DocumentFragment} fragment
|
|
189
|
+
* @param { { [k: string] : any }? } [modules]
|
|
190
|
+
* @param {...*} data
|
|
191
|
+
* @returns the template
|
|
192
|
+
*/
|
|
193
|
+
static fromFragment(fragment: DocumentFragment, modules?: {
|
|
194
|
+
[k: string]: any;
|
|
195
|
+
} | null, ...data: any[]): Template;
|
|
196
|
+
/**
|
|
197
|
+
* Creates a template.
|
|
198
|
+
* @param {DocumentFragment} fragment
|
|
199
|
+
* @param {{ [x: string]: any; } | null | undefined} modules
|
|
200
|
+
* @param {any[]} dataStack
|
|
201
|
+
*/
|
|
202
|
+
constructor(fragment: DocumentFragment, modules: {
|
|
203
|
+
[x: string]: any;
|
|
204
|
+
} | null | undefined, dataStack: any[]);
|
|
205
|
+
/**
|
|
206
|
+
* Creates a new Template replacing the modules and dataStack from a context.
|
|
207
|
+
* @param {{modules: { [x: string]: any; } | null | undefined, data: any[]}} context
|
|
208
|
+
*/
|
|
209
|
+
withContext({ modules, data }: {
|
|
210
|
+
modules: {
|
|
211
|
+
[x: string]: any;
|
|
212
|
+
} | null | undefined;
|
|
213
|
+
data: any[];
|
|
214
|
+
}): Template;
|
|
215
|
+
/**
|
|
216
|
+
* Creates a new Template replacing the modules and dataStack from a registry.
|
|
217
|
+
* @param any registry
|
|
218
|
+
*/
|
|
219
|
+
withContextFrom(registry: any): Template;
|
|
220
|
+
/**
|
|
221
|
+
* Creates a new Template replacing the fragment.
|
|
222
|
+
* @param {DocumentFragment} fragment
|
|
223
|
+
*/
|
|
224
|
+
withFragment(fragment: DocumentFragment): Template;
|
|
225
|
+
/**
|
|
226
|
+
* Creates a new Template with a new module added.
|
|
227
|
+
* @param {string?} name
|
|
228
|
+
* @param {{[k: string]: any}} value
|
|
229
|
+
*/
|
|
230
|
+
withModule(name: string | null, value: {
|
|
231
|
+
[k: string]: any;
|
|
232
|
+
}): Template;
|
|
233
|
+
/**
|
|
234
|
+
* Creates a new Template replacing the modules.
|
|
235
|
+
* @param {{ [x: string]: any; }?} modules
|
|
236
|
+
*/
|
|
237
|
+
withModules(modules: {
|
|
238
|
+
[x: string]: any;
|
|
239
|
+
} | null): Template;
|
|
240
|
+
/**
|
|
241
|
+
* Creates a new Template replacing the data stack.
|
|
242
|
+
* @param {any[]} dataStack the dataStack
|
|
243
|
+
*/
|
|
244
|
+
withData(dataStack: any[]): Template;
|
|
245
|
+
/**
|
|
246
|
+
* Creates a new Template with new a data overlay added to the stack.
|
|
247
|
+
* @param {...*} data
|
|
248
|
+
*/
|
|
249
|
+
withOverlay(...data: any[]): Template;
|
|
250
|
+
/**
|
|
251
|
+
* Evaluates an expression using the configured modules and data.
|
|
252
|
+
* @param {string} expression
|
|
253
|
+
* @param {(typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED)?} [mode]
|
|
254
|
+
* @param {...*} data
|
|
255
|
+
*/
|
|
256
|
+
evaluate(expression: string, mode?: (typeof Expressions.MODE_EXPRESSION | typeof Expressions.MODE_TEMPLATED) | null, ...data: any[]): void;
|
|
257
|
+
/**
|
|
258
|
+
* Returns an expression evaluator with bound modules and dataStack.
|
|
259
|
+
*/
|
|
260
|
+
evaluator(): ExpressionEvaluator;
|
|
261
|
+
/**
|
|
262
|
+
* Renders the template.
|
|
263
|
+
* @returns a DocumentFragment
|
|
264
|
+
*/
|
|
265
|
+
render(): DocumentFragment;
|
|
266
|
+
/**
|
|
267
|
+
* Renders this template on the Element (replacing children).
|
|
268
|
+
* @param {Element} el
|
|
269
|
+
*/
|
|
270
|
+
renderTo(el: Element): void;
|
|
271
|
+
/**
|
|
272
|
+
* Renders this template appending the resulting fragment to the Element.
|
|
273
|
+
* @param {Element} el
|
|
274
|
+
*/
|
|
275
|
+
appendTo(el: Element): void;
|
|
276
|
+
/**
|
|
277
|
+
* Renders this template appending the resulting fragment to the first Element maching the selector, if exists.
|
|
278
|
+
* @param {string} selector
|
|
279
|
+
*/
|
|
280
|
+
renderToSelector(selector: string): void;
|
|
281
|
+
/**
|
|
282
|
+
* Renders this template appending the resulting fragment to the Element maching the selector, if exists.
|
|
283
|
+
* @param {string} selector
|
|
284
|
+
*/
|
|
285
|
+
appendToSelector(selector: string): void;
|
|
286
|
+
}
|
|
287
|
+
declare class RenderError extends Error {
|
|
288
|
+
#private;
|
|
289
|
+
node: any;
|
|
290
|
+
constructor(message: any, nodeOrFragment: any, cause: any);
|
|
291
|
+
static stringify(nodeOrFragment: any): string;
|
|
292
|
+
}
|
|
293
|
+
declare class Registry {
|
|
294
|
+
#private;
|
|
295
|
+
defineElement(tag: any, klass: any): this;
|
|
296
|
+
defineModule(name: any, value: any): this;
|
|
297
|
+
defineModules(ms: any): this;
|
|
298
|
+
defineComponent(name: any, value: any): this;
|
|
299
|
+
defineData(...data: any[]): this;
|
|
300
|
+
defineOverlay(...data: any[]): this;
|
|
301
|
+
defineMapper(k: any, v: any): this;
|
|
302
|
+
plugin(p: any): this;
|
|
303
|
+
configure(): this;
|
|
304
|
+
get upgrades(): MapIterator<[any, any]>;
|
|
305
|
+
context(): {
|
|
306
|
+
modules: any;
|
|
307
|
+
data: any[];
|
|
308
|
+
};
|
|
309
|
+
evaluator(): ExpressionEvaluator;
|
|
310
|
+
component(name: any): any;
|
|
311
|
+
}
|
|
312
|
+
declare const registry: Registry;
|
|
313
|
+
declare class Templates {
|
|
314
|
+
static fromHtml(html: any): Template;
|
|
315
|
+
static fromSelector(selector: any): Template;
|
|
316
|
+
static fromTemplate(templateEl: any): Template;
|
|
317
|
+
static fromFragment(fragment: any): Template;
|
|
318
|
+
}
|
|
319
|
+
declare class Rendering {
|
|
320
|
+
static waitFor(el: any): Promise<void>;
|
|
321
|
+
static waitForChildren(el: any): Promise<void>;
|
|
322
|
+
}
|
|
323
|
+
export type Mapper = {
|
|
324
|
+
unmarshal: (val: string | null | undefined, name: string, el: Element) => any;
|
|
325
|
+
marshal: (val: any, name: string, el: Element) => string | null;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* An attribute Mapper.
|
|
329
|
+
*
|
|
330
|
+
* @typedef {object} Mapper
|
|
331
|
+
* @property {(val: string|null|undefined, name: string, el: Element) => any} unmarshal
|
|
332
|
+
* @property {(val: any, name: string, el: Element) => string|null} marshal
|
|
333
|
+
*/
|
|
334
|
+
declare class ParsedElement extends HTMLElement {
|
|
335
|
+
#private;
|
|
336
|
+
static BITS: {
|
|
337
|
+
enqueue: (el: any) => void;
|
|
338
|
+
SLOTS: boolean;
|
|
339
|
+
OBSERVED: never[];
|
|
340
|
+
/** @type {Record<string, Mapper>} */
|
|
341
|
+
ATTR_TO_MAPPER: Record<string, Mapper>;
|
|
342
|
+
TEMPLATES: {};
|
|
343
|
+
};
|
|
344
|
+
static get observedAttributes(): never[];
|
|
345
|
+
unmarshal(attr: any, str: any): any;
|
|
346
|
+
marshal(attr: any, value: any): string | null;
|
|
347
|
+
/**
|
|
348
|
+
* @param {string} [name] - The name of the template target, defaults to 'default'
|
|
349
|
+
*/
|
|
350
|
+
template(name?: string): any;
|
|
351
|
+
connectedCallback(): void;
|
|
352
|
+
attributeChangedCallback(attr: any, oldValue: any, newValue: any): void;
|
|
353
|
+
formDisabledCallback(disabled: any): void;
|
|
354
|
+
upgrade(): Promise<void>;
|
|
355
|
+
render(c: any): void;
|
|
356
|
+
reflect(fn: any): void;
|
|
357
|
+
reflectTo(attr: any, value: any): void;
|
|
358
|
+
}
|
|
359
|
+
export { Attributes, ExpressionEvaluator, Expressions, Fragments, LightSlots, Nodes, ParsedElement, Registry, RenderError, Rendering, Template, Templates, registry };
|
|
360
|
+
|
|
361
|
+
export as namespace ftl;
|