@relax.js/core 1.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.
Files changed (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +188 -0
  3. package/dist/DataLoader.d.ts +51 -0
  4. package/dist/DependencyInjection.d.ts +271 -0
  5. package/dist/DependencyInjectionOld.d.ts +35 -0
  6. package/dist/Metadata.d.ts +8 -0
  7. package/dist/SequentialId.d.ts +47 -0
  8. package/dist/_alt/src/MustardEngine.d.ts +30 -0
  9. package/dist/_alt/src/MustardParser.d.ts +63 -0
  10. package/dist/_alt/src/MustardParser2.d.ts +35 -0
  11. package/dist/_alt/src/pipes.d.ts +93 -0
  12. package/dist/_alt/src/template.d.ts +166 -0
  13. package/dist/_alt/src/tools.d.ts +4 -0
  14. package/dist/_alt/tests/pipes.tests.d.ts +1 -0
  15. package/dist/_alt/tests/template.tests.d.ts +1 -0
  16. package/dist/_alt/vitest.config.d.ts +2 -0
  17. package/dist/collections/Index.d.ts +1 -0
  18. package/dist/collections/LinkedList.d.ts +75 -0
  19. package/dist/collections/Pager.d.ts +15 -0
  20. package/dist/collections/index.js +2 -0
  21. package/dist/collections/index.js.map +7 -0
  22. package/dist/collections/index.mjs +2 -0
  23. package/dist/collections/index.mjs.map +7 -0
  24. package/dist/components/Table.d.ts +13 -0
  25. package/dist/components/index.d.ts +4 -0
  26. package/dist/components/index.js +128 -0
  27. package/dist/components/index.js.map +7 -0
  28. package/dist/components/index.mjs +128 -0
  29. package/dist/components/index.mjs.map +7 -0
  30. package/dist/components/lists/Table.d.ts +59 -0
  31. package/dist/components/lists/TreeView.d.ts +67 -0
  32. package/dist/components/lists/index.d.ts +2 -0
  33. package/dist/components/loader.d.ts +60 -0
  34. package/dist/components/menus/MenuItem.d.ts +30 -0
  35. package/dist/components/menus/TopMenu.d.ts +16 -0
  36. package/dist/components/menus/index.d.ts +2 -0
  37. package/dist/components/panels/tabs.d.ts +15 -0
  38. package/dist/di/index.d.ts +1 -0
  39. package/dist/di/index.js +2 -0
  40. package/dist/di/index.js.map +7 -0
  41. package/dist/di/index.mjs +2 -0
  42. package/dist/di/index.mjs.map +7 -0
  43. package/dist/elements/CopyAttributes.d.ts +2 -0
  44. package/dist/elements/dom.d.ts +18 -0
  45. package/dist/elements/index.d.ts +2 -0
  46. package/dist/elements/index.js +2 -0
  47. package/dist/elements/index.js.map +7 -0
  48. package/dist/elements/index.mjs +2 -0
  49. package/dist/elements/index.mjs.map +7 -0
  50. package/dist/errors.d.ts +71 -0
  51. package/dist/forms/FormReader.d.ts +182 -0
  52. package/dist/forms/FormValidator.d.ts +114 -0
  53. package/dist/forms/ValidationRules.d.ts +103 -0
  54. package/dist/forms/index.d.ts +4 -0
  55. package/dist/forms/index.js +2 -0
  56. package/dist/forms/index.js.map +7 -0
  57. package/dist/forms/index.mjs +2 -0
  58. package/dist/forms/index.mjs.map +7 -0
  59. package/dist/forms/setFormData.d.ts +49 -0
  60. package/dist/getParentComponent.d.ts +43 -0
  61. package/dist/html/TableRenderer.d.ts +44 -0
  62. package/dist/html/TreeBinder.d.ts +9 -0
  63. package/dist/html/html.d.ts +55 -0
  64. package/dist/html/index.d.ts +5 -0
  65. package/dist/html/index.js +2 -0
  66. package/dist/html/index.js.map +7 -0
  67. package/dist/html/index.mjs +2 -0
  68. package/dist/html/index.mjs.map +7 -0
  69. package/dist/html/template.d.ts +167 -0
  70. package/dist/http/ServerSentEvents.d.ts +116 -0
  71. package/dist/http/SimpleWebSocket.d.ts +153 -0
  72. package/dist/http/http.d.ts +177 -0
  73. package/dist/http/index.d.ts +3 -0
  74. package/dist/http/index.js +2 -0
  75. package/dist/http/index.js.map +7 -0
  76. package/dist/http/index.mjs +2 -0
  77. package/dist/http/index.mjs.map +7 -0
  78. package/dist/i18n/i18n.d.ts +105 -0
  79. package/dist/i18n/icu.d.ts +64 -0
  80. package/dist/i18n/index.d.ts +2 -0
  81. package/dist/i18n/index.js +2 -0
  82. package/dist/i18n/index.js.map +7 -0
  83. package/dist/i18n/index.mjs +2 -0
  84. package/dist/i18n/index.mjs.map +7 -0
  85. package/dist/index.d.ts +16 -0
  86. package/dist/index.js +5 -0
  87. package/dist/index.js.map +7 -0
  88. package/dist/index.mjs +5 -0
  89. package/dist/index.mjs.map +7 -0
  90. package/dist/lib/DataLoader.d.ts +51 -0
  91. package/dist/lib/DependencyInjection.d.ts +271 -0
  92. package/dist/lib/InvokeParent.d.ts +10 -0
  93. package/dist/lib/Pipes.d.ts +236 -0
  94. package/dist/lib/SequentialId.d.ts +47 -0
  95. package/dist/lib/collections/Index.d.ts +1 -0
  96. package/dist/lib/collections/LinkedList.d.ts +75 -0
  97. package/dist/lib/collections/Pager.d.ts +15 -0
  98. package/dist/lib/collections/TableRenderer.d.ts +44 -0
  99. package/dist/lib/di/index.d.ts +1 -0
  100. package/dist/lib/elements/CopyAttributes.d.ts +2 -0
  101. package/dist/lib/elements/dom.d.ts +18 -0
  102. package/dist/lib/elements/index.d.ts +2 -0
  103. package/dist/lib/errors.d.ts +71 -0
  104. package/dist/lib/forms/FormReader.d.ts +182 -0
  105. package/dist/lib/forms/FormValidator.d.ts +114 -0
  106. package/dist/lib/forms/ValidationRules.d.ts +103 -0
  107. package/dist/lib/forms/index.d.ts +4 -0
  108. package/dist/lib/forms/setFormData.d.ts +49 -0
  109. package/dist/lib/getParentComponent.d.ts +43 -0
  110. package/dist/lib/html/TableRenderer.d.ts +44 -0
  111. package/dist/lib/html/TreeBinder.d.ts +9 -0
  112. package/dist/lib/html/html.d.ts +55 -0
  113. package/dist/lib/html/html2.d.ts +55 -0
  114. package/dist/lib/html/index.d.ts +5 -0
  115. package/dist/lib/html/m.d.ts +167 -0
  116. package/dist/lib/html/m2.d.ts +8 -0
  117. package/dist/lib/html/m3.d.ts +0 -0
  118. package/dist/lib/html/template.d.ts +167 -0
  119. package/dist/lib/http/HttpClient.d.ts +153 -0
  120. package/dist/lib/http/ServerSentEvents.d.ts +116 -0
  121. package/dist/lib/http/SimpleWebSocket.d.ts +153 -0
  122. package/dist/lib/http/http.d.ts +177 -0
  123. package/dist/lib/http/index.d.ts +3 -0
  124. package/dist/lib/i18n/i18n.d.ts +105 -0
  125. package/dist/lib/i18n/icu.d.ts +64 -0
  126. package/dist/lib/i18n/index.d.ts +2 -0
  127. package/dist/lib/index.d.ts +16 -0
  128. package/dist/lib/routing/NavigateRouteEvent.d.ts +52 -0
  129. package/dist/lib/routing/RouteLink.d.ts +7 -0
  130. package/dist/lib/routing/Routing.d.ts +270 -0
  131. package/dist/lib/routing/RoutingTarget.d.ts +22 -0
  132. package/dist/lib/routing/index.d.ts +7 -0
  133. package/dist/lib/routing/navigation.d.ts +70 -0
  134. package/dist/lib/routing/routeMatching.d.ts +21 -0
  135. package/dist/lib/routing/routeTargetRegistry.d.ts +23 -0
  136. package/dist/lib/routing/types.d.ts +130 -0
  137. package/dist/lib/templates/NodeTemplate.d.ts +38 -0
  138. package/dist/lib/templates/accessorParser.d.ts +87 -0
  139. package/dist/lib/templates/parseTemplate.d.ts +6 -0
  140. package/dist/lib/templates/tokenizer.d.ts +76 -0
  141. package/dist/lib/tools.d.ts +30 -0
  142. package/dist/lib/utils/index.d.ts +4 -0
  143. package/dist/pipes.d.ts +236 -0
  144. package/dist/routing/NavigateRouteEvent.d.ts +52 -0
  145. package/dist/routing/RouteLink.d.ts +7 -0
  146. package/dist/routing/RoutingTarget.d.ts +22 -0
  147. package/dist/routing/index.d.ts +7 -0
  148. package/dist/routing/index.js +5 -0
  149. package/dist/routing/index.js.map +7 -0
  150. package/dist/routing/index.mjs +5 -0
  151. package/dist/routing/index.mjs.map +7 -0
  152. package/dist/routing/navigation.d.ts +70 -0
  153. package/dist/routing/routeMatching.d.ts +21 -0
  154. package/dist/routing/routeTargetRegistry.d.ts +23 -0
  155. package/dist/routing/types.d.ts +130 -0
  156. package/dist/templates/NodeTemplate.d.ts +38 -0
  157. package/dist/templates/accessorParser.d.ts +87 -0
  158. package/dist/templates/parseTemplate.d.ts +6 -0
  159. package/dist/templates/tokenizer.d.ts +76 -0
  160. package/dist/tools.d.ts +30 -0
  161. package/dist/utils/index.d.ts +4 -0
  162. package/dist/utils/index.js +2 -0
  163. package/dist/utils/index.js.map +7 -0
  164. package/dist/utils/index.mjs +2 -0
  165. package/dist/utils/index.mjs.map +7 -0
  166. package/docs/Architecture.md +333 -0
  167. package/docs/DependencyInjection.md +237 -0
  168. package/docs/Errors.md +87 -0
  169. package/docs/GettingStarted.md +231 -0
  170. package/docs/Pipes.md +211 -0
  171. package/docs/Translations.md +312 -0
  172. package/docs/WhyRelaxjs.md +336 -0
  173. package/docs/elements/dom.md +102 -0
  174. package/docs/forms/creating-form-components.md +924 -0
  175. package/docs/forms/form-api.md +94 -0
  176. package/docs/forms/forms.md +99 -0
  177. package/docs/forms/patterns.md +311 -0
  178. package/docs/forms/reading-writing.md +365 -0
  179. package/docs/forms/validation.md +351 -0
  180. package/docs/html/TableRenderer.md +292 -0
  181. package/docs/html/html.md +175 -0
  182. package/docs/html/index.md +54 -0
  183. package/docs/html/template.md +422 -0
  184. package/docs/http/HttpClient.md +459 -0
  185. package/docs/http/ServerSentEvents.md +184 -0
  186. package/docs/http/index.md +109 -0
  187. package/docs/i18n/i18n.md +309 -0
  188. package/docs/i18n/intl-standard.md +178 -0
  189. package/docs/routing/RouteLink.md +98 -0
  190. package/docs/routing/Routing.md +332 -0
  191. package/docs/routing/RoutingTarget.md +136 -0
  192. package/docs/routing/layouts.md +207 -0
  193. package/docs/utilities.md +143 -0
  194. package/package.json +93 -0
@@ -0,0 +1,63 @@
1
+ type Token = TextToken | VariableToken | FunctionToken;
2
+ type TokenType = 'text' | 'variable' | 'function';
3
+ interface BaseToken {
4
+ type: TokenType;
5
+ value: string;
6
+ }
7
+ interface TextToken extends BaseToken {
8
+ type: 'text';
9
+ }
10
+ interface VariableToken extends BaseToken {
11
+ type: 'variable';
12
+ path: string[];
13
+ pipes: string[];
14
+ }
15
+ interface FunctionToken extends BaseToken {
16
+ type: 'function';
17
+ name: string;
18
+ params: string[];
19
+ pipes: string[];
20
+ }
21
+ export type CompiledTemplate = (context: Record<string, any>, pipeFunctions?: PipeFunctions) => string;
22
+ type PipeFunctions = Record<string, (value: any, ...args: any[]) => any>;
23
+ export declare class MustacheParser {
24
+ private static readonly TAG_REGEX;
25
+ private static readonly FUNCTION_REGEX;
26
+ private static readonly PIPE_DELIMITER;
27
+ private static readonly PATH_DELIMITER;
28
+ private cache;
29
+ /**
30
+ * Parse a template string into tokens
31
+ */
32
+ parse(template: string): Token[];
33
+ /**
34
+ * Parse a single tag into a token
35
+ */
36
+ private parseTag;
37
+ /**
38
+ * Compile a template string into a function
39
+ */
40
+ compile(template: string): CompiledTemplate;
41
+ /**
42
+ * Render a single token with the given context
43
+ */
44
+ private renderToken;
45
+ /**
46
+ * Execute a function from the context
47
+ */
48
+ private executeFunction;
49
+ /**
50
+ * Apply pipe transformations to a value
51
+ */
52
+ private applyPipes;
53
+ /**
54
+ * Clear the parser cache
55
+ */
56
+ clearCache(): void;
57
+ }
58
+ export declare class TemplateError extends Error {
59
+ token?: Token;
60
+ constructor(message: string, token?: Token);
61
+ }
62
+ export declare const createTemplate: (template: string) => CompiledTemplate;
63
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Represents an argument in a template function
3
+ * @typedef ArgumentType - Can be a string, number, or variable reference
4
+ */
5
+ export type CurlyTokenType = {
6
+ type: 'string';
7
+ value: string;
8
+ } | {
9
+ type: 'number';
10
+ value: number;
11
+ } | {
12
+ type: 'variable';
13
+ name: string;
14
+ };
15
+ /**
16
+ * Represents a part of the template
17
+ */
18
+ export type CurlyToken = {
19
+ type: 'text';
20
+ content: string;
21
+ } | {
22
+ type: 'variable';
23
+ name: string;
24
+ pipes: string[];
25
+ } | {
26
+ type: 'function';
27
+ signature: string;
28
+ pipes: string[];
29
+ };
30
+ /**
31
+ * Parses a template string and extracts parts
32
+ * @param templateString - String with template variables in {{variable|pipe}} format
33
+ * @returns Array of parsed parts (text, variable, or function)
34
+ */
35
+ export declare function parseCurly(templateString: string): CurlyToken[];
@@ -0,0 +1,93 @@
1
+ export type PipeFunction = (value: any, ...args: any[]) => any;
2
+ /**
3
+ * Converts a string to uppercase
4
+ * @param value The string to convert
5
+ * @returns The uppercase string
6
+ */
7
+ export declare function uppercasePipe(value: string): string;
8
+ /**
9
+ * Converts a string to lowercase
10
+ * @param value The string to convert
11
+ * @returns The lowercase string
12
+ */
13
+ export declare function lowercasePipe(value: string): string;
14
+ /**
15
+ * Capitalizes the first character of a string
16
+ * @param value The string to capitalize
17
+ * @returns The capitalized string
18
+ */
19
+ export declare function capitalizePipe(value: string): string;
20
+ /**
21
+ * Truncates a string to a specified length and adds ellipsis
22
+ * @param value The string to truncate
23
+ * @param length Maximum length before truncation
24
+ * @returns The truncated string with ellipsis if needed
25
+ */
26
+ export declare function truncatePipe(value: string, length: string): string;
27
+ /**
28
+ * Formats a number as USD currency
29
+ * @param value The number to format
30
+ * @returns Formatted currency string
31
+ */
32
+ export declare function currencyPipe(value: number): string;
33
+ /**
34
+ * Formats a date value according to the specified format
35
+ * @param value Date value (string, number, or Date object)
36
+ * @param format Format type: 'short', 'long', or default (ISO)
37
+ * @returns Formatted date string
38
+ */
39
+ export declare function datePipe(value: string | number | Date, format?: string): string;
40
+ /**
41
+ * Joins array elements with the specified separator
42
+ * @param value Array to join
43
+ * @param separator Character(s) to use between elements (defaults to comma)
44
+ * @returns Joined string or original value if not an array
45
+ */
46
+ export declare function joinPipe(value: any[], separator?: string): string | any;
47
+ /**
48
+ * Returns the first element of an array
49
+ * @param value Array to extract from
50
+ * @returns First element or empty string if array is empty/invalid
51
+ */
52
+ export declare function firstPipe(value: any[]): any;
53
+ /**
54
+ * Returns the last element of an array
55
+ * @param value Array to extract from
56
+ * @returns Last element or empty string if array is empty/invalid
57
+ */
58
+ export declare function lastPipe(value: any[]): any;
59
+ /**
60
+ * Returns the keys of an object
61
+ * @param value Object to extract keys from
62
+ * @returns Array of object keys or empty array if not an object
63
+ */
64
+ export declare function keysPipe(value: object): string[];
65
+ /**
66
+ * Returns a default value if the input is falsy
67
+ * @param value Input value to check
68
+ * @param defaultValue Value to return if input is falsy
69
+ * @returns Original value or default value
70
+ */
71
+ export declare function defaultPipe(value: any, defaultValue: string): any;
72
+ /**
73
+ * Implements ternary operator as a pipe
74
+ * @param value Condition to evaluate
75
+ * @param trueValue Value to return if condition is truthy
76
+ * @param falseValue Value to return if condition is falsy
77
+ * @returns Selected value based on condition
78
+ */
79
+ export declare function ternaryPipe(value: any, trueValue: string, falseValue: string): string;
80
+ /**
81
+ * Creates and returns a map of all available pipe functions
82
+ * @returns Map of pipe name to pipe function
83
+ */
84
+ export declare function createPipeRegistry(): Map<string, PipeFunction>;
85
+ export declare const defaultPipes: Map<string, PipeFunction>;
86
+ /**
87
+ * Applies a series of pipes to a value
88
+ * @param value Initial value to transform
89
+ * @param pipes Array of pipe strings (name and optional arguments separated by ':')
90
+ * @param pipeFunctions Optional custom pipe registry (uses defaultPipes if not provided)
91
+ * @returns The transformed value after applying all pipes
92
+ */
93
+ export declare function applyPipes(value: any, pipes: string[], pipeFunctions?: Map<string, PipeFunction>): any;
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @module Template
3
+ * A lightweight DOM-based template engine inspired by Mustache/Handlebars but with enhanced
4
+ * functionality for direct DOM manipulation without virtual DOM overhead.
5
+ *
6
+ * Design philosophy:
7
+ * - Keep DOM references intact during updates instead of replacing elements
8
+ * - Enable fine-grained binding at the attribute and text node level
9
+ * - Support component-like patterns with function calls and pipes
10
+ * - Provide conditional rendering and iteration with minimal syntax
11
+ */
12
+ /**
13
+ * Typed representation of arguments in template function calls
14
+ * Used during parsing to distinguish between literal values and variable references
15
+ * before they're resolved against the actual data context
16
+ */
17
+ export type CurlyTokenType = {
18
+ type: 'string';
19
+ value: string;
20
+ } | {
21
+ type: 'number';
22
+ value: number;
23
+ } | {
24
+ type: 'variable';
25
+ name: string;
26
+ };
27
+ /**
28
+ * Internal AST (Abstract Syntax Tree) nodes for template parsing
29
+ * Each token represents a distinct part of the template with its own rendering logic
30
+ */
31
+ export type CurlyToken = {
32
+ type: 'text';
33
+ content: string;
34
+ } | {
35
+ type: 'variable';
36
+ name: string;
37
+ pipes: string[];
38
+ } | {
39
+ type: 'function';
40
+ signature: string;
41
+ pipes: string[];
42
+ };
43
+ /**
44
+ * Tokenizes a template string into a sequence of text and expression tokens
45
+ * Functions as the lexical analyzer in the template compilation process
46
+ * @param templateString - Raw template string with embedded expressions
47
+ * @returns AST nodes representing the template structure
48
+ */
49
+ export declare function parseCurly(templateString: string): CurlyToken[];
50
+ /**
51
+ * Orchestrates the DOM traversal and binding process
52
+ * Acts as a registry for all data and initialization callbacks
53
+ * that will be triggered when template is rendered
54
+ */
55
+ export interface ParserContext {
56
+ currentNode: Node;
57
+ nodePath: number[];
58
+ getNodePath(node: Node): number[];
59
+ traverseNode(node: Node): void;
60
+ traverseChildren(node: Node): void;
61
+ /**
62
+ * Binds initialization callbacks to be executed after node structure is created
63
+ * @param callback - Function to run during initialization phase
64
+ */
65
+ bindInit(callback: TemplateCallback): void;
66
+ /**
67
+ * Binds data update callbacks to refresh nodes when data changes
68
+ * @param callback - Function to run when data is updated
69
+ */
70
+ bindData(callback: TemplateCallback): void;
71
+ }
72
+ /**
73
+ * Control flow enum for DOM traversal
74
+ * Allows processors to guide how traversal continues after their execution,
75
+ * enabling efficient skipping of branches or preventing double-processing
76
+ */
77
+ export declare enum NodeProcessorResult {
78
+ /**
79
+ * Stop processing the current node, as it was fully handled
80
+ */
81
+ Stop = 0,
82
+ /**
83
+ * Process attributes but skip child nodes
84
+ */
85
+ VisitAttributesOnly = 1,
86
+ /**
87
+ * Continue normal processing (process this node and its children)
88
+ */
89
+ Continue = 2
90
+ }
91
+ /**
92
+ * Node processors form the plugin architecture of the template system
93
+ * Each processor examines a node for specific binding patterns and registers
94
+ * appropriate callbacks when matches are found
95
+ * @param node - Current DOM node in traversal
96
+ * @param context - Context for registering bindings
97
+ * @returns Flow control directive for traversal
98
+ */
99
+ export type NodeProcessor = (node: Node, context: ParserContext) => NodeProcessorResult;
100
+ /**
101
+ * Two-tiered data context for template rendering
102
+ * Separates component-level data (methods, properties) from
103
+ * template-specific data (like loop variables and conditionals)
104
+ */
105
+ export interface TemplateContext {
106
+ node: Node;
107
+ component: object;
108
+ data: object;
109
+ getNode(path: number[]): Node;
110
+ }
111
+ /**
112
+ * Main entry point and API facade for the template engine
113
+ * Name is a playful reference to "cutting the mustard" - a progressive enhancement technique
114
+ * Processes templates through all registered binders in sequence
115
+ * @param htmlOrNode - Raw template input (string or DOM)
116
+ * @returns Compiled template ready for data binding
117
+ */
118
+ export declare function beTheMustard(htmlOrNode: string | Node): Template;
119
+ /**
120
+ * Compiles a template string into an executable rendering function
121
+ * Processes nested expressions and builds a composite renderer from individual part handlers
122
+ * Represents the core template compilation process
123
+ * @param text - Raw template string with expressions
124
+ * @returns Compiled rendering function
125
+ */
126
+ export declare function createCallbackFromMustard(text: string): TemplateCallback;
127
+ /**
128
+ * Processes element attributes for data binding expressions
129
+ * Handles both function calls and curly syntax in attributes
130
+ * @param node - DOM node to process
131
+ * @param parserContext - Parser context for callback registration
132
+ * @returns Processing directive for traversal control
133
+ */
134
+ export declare function dataAttributeBinder(node: Node, parserContext: ParserContext): NodeProcessorResult;
135
+ /**
136
+ * Function type for template rendering callbacks
137
+ * Takes a context (data + component) and produces output
138
+ */
139
+ export type TemplateCallback = (ctx: TemplateContext) => any;
140
+ /**
141
+ * Main template class that manages binding and rendering
142
+ * Acts as the primary interface for template usage
143
+ */
144
+ export declare class Template {
145
+ element: HTMLElement;
146
+ private functionBinders;
147
+ private dataAssigners;
148
+ /**
149
+ * Creates a new template instance
150
+ * @param element - Root DOM element for this template
151
+ * @param context - Either a ParserContext from parsing or another Template for cloning
152
+ */
153
+ constructor(element: HTMLElement, context: ParserContext | Template);
154
+ /**
155
+ * Binds data to the template, triggering all data update callbacks
156
+ * @param data - Data context containing component and data objects
157
+ */
158
+ bind(data: TemplateContext): void;
159
+ /**
160
+ * Creates a clone of this template with a new root element
161
+ * Preserves all bindings and callbacks
162
+ * @param clonedElement - New element to use as root for the clone
163
+ * @returns New template instance with same bindings
164
+ */
165
+ clone(clonedElement: HTMLElement): Template;
166
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Resolve a value from the context using a path array
3
+ */
4
+ export declare function resolveValue(path: string[], context: Record<string, any>): any | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export { LinkedList, Node } from "./LinkedList";
@@ -0,0 +1,75 @@
1
+ /**
2
+ * A node in the @see LinkedList.
3
+ */
4
+ export declare class Node<T> {
5
+ value: T;
6
+ private removeCallback;
7
+ /**
8
+ * Next node unless last one.
9
+ */
10
+ next: Node<T> | null;
11
+ /**
12
+ * Previous node unless first one.
13
+ */
14
+ prev: Node<T> | null;
15
+ /**
16
+ * Constructor.
17
+ * @param value Value contained in the node.
18
+ */
19
+ constructor(value: T, removeCallback: () => void);
20
+ /**
21
+ * Remove this node.
22
+ * Will notify the list of the update to ensure correct element count.
23
+ */
24
+ remove(): void;
25
+ }
26
+ /**
27
+ * A trivial linked list implementation.
28
+ */
29
+ export declare class LinkedList<T> {
30
+ private _first?;
31
+ private _last?;
32
+ private _length;
33
+ /**
34
+ * Add a value to the beginning of the list.
35
+ * @param value Value that should be contained in the node.
36
+ */
37
+ addFirst(value: T): void;
38
+ /**
39
+ * Add a value to the end of the list.
40
+ * @param value Value that should be contained in a node.
41
+ */
42
+ addLast(value: T): void;
43
+ /**
44
+ * Remove a node from the beginning of the list.
45
+ * @returns Value contained in the first node.
46
+ */
47
+ removeFirst(): T;
48
+ /**
49
+ * Remove a node from the end of the list.
50
+ * @returns Value contained in the last node.
51
+ */
52
+ removeLast(): T;
53
+ /**
54
+ * Number of nodes in the list.
55
+ *
56
+ * The count works as long as you do not manually remove nodes (by assigning next/prev to the neighbors).
57
+ */
58
+ get length(): number;
59
+ /**
60
+ * First ndoe.
61
+ */
62
+ get first(): Node<T> | undefined;
63
+ /**
64
+ * Contained value of the first node.
65
+ */
66
+ get firstValue(): T | undefined;
67
+ /**
68
+ * Last node.
69
+ */
70
+ get last(): Node<T> | undefined;
71
+ /**
72
+ * Contained value of the last node.
73
+ */
74
+ get lastValue(): T | undefined;
75
+ }
@@ -0,0 +1,15 @@
1
+ export declare class PageSelectedEvent extends CustomEvent<number> {
2
+ page: number;
3
+ constructor(page: number);
4
+ }
5
+ export declare class Pager {
6
+ private container;
7
+ private totalCount;
8
+ private pageSize;
9
+ private currentPage;
10
+ constructor(container: HTMLElement, totalCount: number, pageSize: number);
11
+ private render;
12
+ private selectPage;
13
+ update(totalCount: number): void;
14
+ getCurrentPage(): number;
15
+ }
@@ -0,0 +1,2 @@
1
+ var h=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var o=(s,t)=>{for(var e in t)h(s,e,{get:t[e],enumerable:!0})},f=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _(t))!u.call(s,r)&&r!==e&&h(s,r,{get:()=>t[r],enumerable:!(n=a(t,r))||n.enumerable});return s};var v=s=>f(h({},"__esModule",{value:!0}),s);var d={};o(d,{LinkedList:()=>l,Node:()=>i});module.exports=v(d);var i=class{constructor(t,e){this.value=t;this.removeCallback=e;this.next=null;this.prev=null}remove(){this.prev.next=this.next,this.next.prev=this.prev,this.removeCallback()}},l=class{constructor(){this._length=0}addFirst(t){let e=new i(t,()=>this._length--);this._first?(e.next=this._first,this._first.prev=e,this._first=e):(this._first=e,this._last=this._first),this._length++}addLast(t){let e=new i(t,()=>this._length--);this._first?(e.prev=this._last,this._last.next=e,this._last=e):(this._first=e,this._last=this._first),this._length++}removeFirst(){if(!this.first)throw new Error("The list is empty.");let t=this._first.value;return this._first=this._first.next,this._length--,t}removeLast(){if(!this.last)throw new Error("The list is empty.");let t=this._last.value;return this._last=this._last.prev,this._length--,t}get length(){return this._length}get first(){return this._first}get firstValue(){return this._first?.value}get last(){return this._last}get lastValue(){return this._last?.value}};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/collections/Index.ts", "../../src/collections/LinkedList.ts"],
4
+ "sourcesContent": ["export {LinkedList, Node} from \"./LinkedList\";", "/**\r\n * A node in the @see LinkedList.\r\n */\r\nexport class Node<T> {\r\n /**\r\n * Next node unless last one.\r\n */\r\n public next: Node<T> | null = null;\r\n /**\r\n * Previous node unless first one.\r\n */\r\n public prev: Node<T> | null = null;\r\n\r\n /**\r\n * Constructor.\r\n * @param value Value contained in the node.\r\n */\r\n constructor(public value: T, private removeCallback: () => void) {}\r\n\r\n /**\r\n * Remove this node.\r\n * Will notify the list of the update to ensure correct element count.\r\n */\r\n remove() {\r\n this.prev.next = this.next;\r\n this.next.prev = this.prev;\r\n this.removeCallback();\r\n }\r\n}\r\n\r\n/**\r\n * A trivial linked list implementation.\r\n */\r\nexport class LinkedList<T> {\r\n private _first?: Node<T>;\r\n private _last?: Node<T>;\r\n private _length = 0;\r\n\r\n /**\r\n * Add a value to the beginning of the list.\r\n * @param value Value that should be contained in the node.\r\n */\r\n addFirst(value: T) {\r\n const newNode = new Node(value, () => this._length--);\r\n if (!this._first) {\r\n this._first = newNode;\r\n this._last = this._first;\r\n } else {\r\n newNode.next = this._first;\r\n this._first.prev = newNode;\r\n this._first = newNode;\r\n }\r\n\r\n this._length++;\r\n }\r\n\r\n /**\r\n * Add a value to the end of the list.\r\n * @param value Value that should be contained in a node.\r\n */\r\n addLast(value: T) {\r\n const newNode = new Node(value, () => this._length--);\r\n if (!this._first) {\r\n this._first = newNode;\r\n this._last = this._first;\r\n } else {\r\n newNode.prev = this._last;\r\n this._last.next = newNode;\r\n this._last = newNode;\r\n }\r\n\r\n this._length++;\r\n }\r\n\r\n /**\r\n * Remove a node from the beginning of the list.\r\n * @returns Value contained in the first node.\r\n */\r\n removeFirst(): T {\r\n if (!this.first) {\r\n throw new Error('The list is empty.');\r\n }\r\n\r\n const value = this._first.value;\r\n this._first = this._first.next;\r\n this._length--;\r\n return value;\r\n }\r\n\r\n /**\r\n * Remove a node from the end of the list.\r\n * @returns Value contained in the last node.\r\n */\r\n removeLast(): T {\r\n if (!this.last) {\r\n throw new Error('The list is empty.');\r\n }\r\n\r\n const value = this._last.value;\r\n this._last = this._last.prev;\r\n this._length--;\r\n return value;\r\n }\r\n\r\n /**\r\n * Number of nodes in the list.\r\n *\r\n * The count works as long as you do not manually remove nodes (by assigning next/prev to the neighbors).\r\n */\r\n get length(): number {\r\n return this._length;\r\n }\r\n\r\n /**\r\n * First ndoe.\r\n */\r\n get first(): Node<T> | undefined {\r\n return this._first;\r\n }\r\n\r\n /**\r\n * Contained value of the first node.\r\n */\r\n get firstValue(): T | undefined {\r\n return this._first?.value;\r\n }\r\n\r\n /**\r\n * Last node.\r\n */\r\n get last(): Node<T> | undefined {\r\n return this._last;\r\n }\r\n\r\n /**\r\n * Contained value of the last node.\r\n */\r\n get lastValue(): T | undefined {\r\n return this._last?.value;\r\n }\r\n}\r\n"],
5
+ "mappings": "4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,SAAAC,IAAA,eAAAC,EAAAJ,GCGO,IAAMK,EAAN,KAAc,CAcjB,YAAmBC,EAAkBC,EAA4B,CAA9C,WAAAD,EAAkB,oBAAAC,EAVrC,KAAO,KAAuB,KAI9B,KAAO,KAAuB,IAMoC,CAMlE,QAAS,CACL,KAAK,KAAK,KAAO,KAAK,KACtB,KAAK,KAAK,KAAO,KAAK,KACtB,KAAK,eAAe,CACxB,CACJ,EAKaC,EAAN,KAAoB,CAApB,cAGH,KAAQ,QAAU,EAMlB,SAASF,EAAU,CACf,IAAMG,EAAU,IAAIJ,EAAKC,EAAO,IAAM,KAAK,SAAS,EAC/C,KAAK,QAING,EAAQ,KAAO,KAAK,OACpB,KAAK,OAAO,KAAOA,EACnB,KAAK,OAASA,IALd,KAAK,OAASA,EACd,KAAK,MAAQ,KAAK,QAOtB,KAAK,SACT,CAMA,QAAQH,EAAU,CACd,IAAMG,EAAU,IAAIJ,EAAKC,EAAO,IAAM,KAAK,SAAS,EAC/C,KAAK,QAING,EAAQ,KAAO,KAAK,MACpB,KAAK,MAAM,KAAOA,EAClB,KAAK,MAAQA,IALb,KAAK,OAASA,EACd,KAAK,MAAQ,KAAK,QAOtB,KAAK,SACT,CAMA,aAAiB,CACb,GAAI,CAAC,KAAK,MACN,MAAM,IAAI,MAAM,oBAAoB,EAGxC,IAAMH,EAAQ,KAAK,OAAO,MAC1B,YAAK,OAAS,KAAK,OAAO,KAC1B,KAAK,UACEA,CACX,CAMA,YAAgB,CACZ,GAAI,CAAC,KAAK,KACN,MAAM,IAAI,MAAM,oBAAoB,EAGxC,IAAMA,EAAQ,KAAK,MAAM,MACzB,YAAK,MAAQ,KAAK,MAAM,KACxB,KAAK,UACEA,CACX,CAOA,IAAI,QAAiB,CACjB,OAAO,KAAK,OAChB,CAKA,IAAI,OAA6B,CAC7B,OAAO,KAAK,MAChB,CAKA,IAAI,YAA4B,CAC5B,OAAO,KAAK,QAAQ,KACxB,CAKA,IAAI,MAA4B,CAC5B,OAAO,KAAK,KAChB,CAKA,IAAI,WAA2B,CAC3B,OAAO,KAAK,OAAO,KACvB,CACJ",
6
+ "names": ["Index_exports", "__export", "LinkedList", "Node", "__toCommonJS", "Node", "value", "removeCallback", "LinkedList", "newNode"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var s=class{constructor(e,t){this.value=e;this.removeCallback=t;this.next=null;this.prev=null}remove(){this.prev.next=this.next,this.next.prev=this.prev,this.removeCallback()}},i=class{constructor(){this._length=0}addFirst(e){let t=new s(e,()=>this._length--);this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=this._first),this._length++}addLast(e){let t=new s(e,()=>this._length--);this._first?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=this._first),this._length++}removeFirst(){if(!this.first)throw new Error("The list is empty.");let e=this._first.value;return this._first=this._first.next,this._length--,e}removeLast(){if(!this.last)throw new Error("The list is empty.");let e=this._last.value;return this._last=this._last.prev,this._length--,e}get length(){return this._length}get first(){return this._first}get firstValue(){return this._first?.value}get last(){return this._last}get lastValue(){return this._last?.value}};export{i as LinkedList,s as Node};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/collections/LinkedList.ts"],
4
+ "sourcesContent": ["/**\r\n * A node in the @see LinkedList.\r\n */\r\nexport class Node<T> {\r\n /**\r\n * Next node unless last one.\r\n */\r\n public next: Node<T> | null = null;\r\n /**\r\n * Previous node unless first one.\r\n */\r\n public prev: Node<T> | null = null;\r\n\r\n /**\r\n * Constructor.\r\n * @param value Value contained in the node.\r\n */\r\n constructor(public value: T, private removeCallback: () => void) {}\r\n\r\n /**\r\n * Remove this node.\r\n * Will notify the list of the update to ensure correct element count.\r\n */\r\n remove() {\r\n this.prev.next = this.next;\r\n this.next.prev = this.prev;\r\n this.removeCallback();\r\n }\r\n}\r\n\r\n/**\r\n * A trivial linked list implementation.\r\n */\r\nexport class LinkedList<T> {\r\n private _first?: Node<T>;\r\n private _last?: Node<T>;\r\n private _length = 0;\r\n\r\n /**\r\n * Add a value to the beginning of the list.\r\n * @param value Value that should be contained in the node.\r\n */\r\n addFirst(value: T) {\r\n const newNode = new Node(value, () => this._length--);\r\n if (!this._first) {\r\n this._first = newNode;\r\n this._last = this._first;\r\n } else {\r\n newNode.next = this._first;\r\n this._first.prev = newNode;\r\n this._first = newNode;\r\n }\r\n\r\n this._length++;\r\n }\r\n\r\n /**\r\n * Add a value to the end of the list.\r\n * @param value Value that should be contained in a node.\r\n */\r\n addLast(value: T) {\r\n const newNode = new Node(value, () => this._length--);\r\n if (!this._first) {\r\n this._first = newNode;\r\n this._last = this._first;\r\n } else {\r\n newNode.prev = this._last;\r\n this._last.next = newNode;\r\n this._last = newNode;\r\n }\r\n\r\n this._length++;\r\n }\r\n\r\n /**\r\n * Remove a node from the beginning of the list.\r\n * @returns Value contained in the first node.\r\n */\r\n removeFirst(): T {\r\n if (!this.first) {\r\n throw new Error('The list is empty.');\r\n }\r\n\r\n const value = this._first.value;\r\n this._first = this._first.next;\r\n this._length--;\r\n return value;\r\n }\r\n\r\n /**\r\n * Remove a node from the end of the list.\r\n * @returns Value contained in the last node.\r\n */\r\n removeLast(): T {\r\n if (!this.last) {\r\n throw new Error('The list is empty.');\r\n }\r\n\r\n const value = this._last.value;\r\n this._last = this._last.prev;\r\n this._length--;\r\n return value;\r\n }\r\n\r\n /**\r\n * Number of nodes in the list.\r\n *\r\n * The count works as long as you do not manually remove nodes (by assigning next/prev to the neighbors).\r\n */\r\n get length(): number {\r\n return this._length;\r\n }\r\n\r\n /**\r\n * First ndoe.\r\n */\r\n get first(): Node<T> | undefined {\r\n return this._first;\r\n }\r\n\r\n /**\r\n * Contained value of the first node.\r\n */\r\n get firstValue(): T | undefined {\r\n return this._first?.value;\r\n }\r\n\r\n /**\r\n * Last node.\r\n */\r\n get last(): Node<T> | undefined {\r\n return this._last;\r\n }\r\n\r\n /**\r\n * Contained value of the last node.\r\n */\r\n get lastValue(): T | undefined {\r\n return this._last?.value;\r\n }\r\n}\r\n"],
5
+ "mappings": "AAGO,IAAMA,EAAN,KAAc,CAcjB,YAAmBC,EAAkBC,EAA4B,CAA9C,WAAAD,EAAkB,oBAAAC,EAVrC,KAAO,KAAuB,KAI9B,KAAO,KAAuB,IAMoC,CAMlE,QAAS,CACL,KAAK,KAAK,KAAO,KAAK,KACtB,KAAK,KAAK,KAAO,KAAK,KACtB,KAAK,eAAe,CACxB,CACJ,EAKaC,EAAN,KAAoB,CAApB,cAGH,KAAQ,QAAU,EAMlB,SAASF,EAAU,CACf,IAAMG,EAAU,IAAIJ,EAAKC,EAAO,IAAM,KAAK,SAAS,EAC/C,KAAK,QAING,EAAQ,KAAO,KAAK,OACpB,KAAK,OAAO,KAAOA,EACnB,KAAK,OAASA,IALd,KAAK,OAASA,EACd,KAAK,MAAQ,KAAK,QAOtB,KAAK,SACT,CAMA,QAAQH,EAAU,CACd,IAAMG,EAAU,IAAIJ,EAAKC,EAAO,IAAM,KAAK,SAAS,EAC/C,KAAK,QAING,EAAQ,KAAO,KAAK,MACpB,KAAK,MAAM,KAAOA,EAClB,KAAK,MAAQA,IALb,KAAK,OAASA,EACd,KAAK,MAAQ,KAAK,QAOtB,KAAK,SACT,CAMA,aAAiB,CACb,GAAI,CAAC,KAAK,MACN,MAAM,IAAI,MAAM,oBAAoB,EAGxC,IAAMH,EAAQ,KAAK,OAAO,MAC1B,YAAK,OAAS,KAAK,OAAO,KAC1B,KAAK,UACEA,CACX,CAMA,YAAgB,CACZ,GAAI,CAAC,KAAK,KACN,MAAM,IAAI,MAAM,oBAAoB,EAGxC,IAAMA,EAAQ,KAAK,MAAM,MACzB,YAAK,MAAQ,KAAK,MAAM,KACxB,KAAK,UACEA,CACX,CAOA,IAAI,QAAiB,CACjB,OAAO,KAAK,OAChB,CAKA,IAAI,OAA6B,CAC7B,OAAO,KAAK,MAChB,CAKA,IAAI,YAA4B,CAC5B,OAAO,KAAK,QAAQ,KACxB,CAKA,IAAI,MAA4B,CAC5B,OAAO,KAAK,KAChB,CAKA,IAAI,WAA2B,CAC3B,OAAO,KAAK,OAAO,KACvB,CACJ",
6
+ "names": ["Node", "value", "removeCallback", "LinkedList", "newNode"]
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { DataLoader } from '../lib/DataLoader';
2
+ export declare class RelaxedTable extends HTMLElement {
3
+ private renderer;
4
+ private sorter;
5
+ private pager;
6
+ private table;
7
+ private template;
8
+ private loader;
9
+ private pageSize;
10
+ connectedCallback(): void;
11
+ set dataLoader(loader: DataLoader);
12
+ private loadPage;
13
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./menus/index";
2
+ export * from "../lib/routing/RoutingTarget";
3
+ export * from "../lib/routing/RouteLink";
4
+ export * from "./lists/index";