web-documentation 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.
@@ -0,0 +1,266 @@
1
+ <!-- !/usr/bin/env markdown
2
+ -*- coding: utf-8 -*-
3
+ region header
4
+ Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
5
+
6
+ License
7
+ -------
8
+
9
+ This library written by Torben Sickert stand under a creative commons naming
10
+ 3.0 unported license. See https://creativecommons.org/licenses/by/3.0/deed.de
11
+ endregion -->
12
+
13
+ Project status
14
+ --------------
15
+
16
+ [![npm](https://img.shields.io/npm/v/clientnode?color=%23d55e5d&label=npm%20package%20version&logoColor=%23d55e5d&style=for-the-badge)](https://www.npmjs.com/package/clientnode)
17
+ [![npm downloads](https://img.shields.io/npm/dy/clientnode.svg?style=for-the-badge)](https://www.npmjs.com/package/clientnode)
18
+
19
+ [![build](https://img.shields.io/github/actions/workflow/status/thaibault/clientnode/build.yaml?style=for-the-badge)](https://github.com/thaibault/clientnode/actions/workflows/build.yaml)
20
+
21
+ [![check types](https://img.shields.io/github/actions/workflow/status/thaibault/clientnode/check-types.yaml?label=Check%20types&style=for-the-badge)](https://github.com/thaibault/clientnode/actions/workflows/check-types.yaml)
22
+ [![lint](https://img.shields.io/github/actions/workflow/status/thaibault/clientnode/lint.yaml?label=lint&style=for-the-badge)](https://github.com/thaibault/clientnode/actions/workflows/lint.yaml)
23
+ [![test](https://img.shields.io/github/actions/workflow/status/thaibault/clientnode/test-coverage-report.yaml?label=test&style=for-the-badge)](https://github.com/thaibault/clientnode/actions/workflows/test-coverage-report.yaml)
24
+
25
+ [![code coverage](https://img.shields.io/coverallsCoverage/github/thaibault/clientnode?label=code%20coverage&style=for-the-badge)](https://coveralls.io/github/thaibault/clientnode)
26
+
27
+ [![documentation website](https://img.shields.io/website-up-down-green-red/https/torben.website/clientnode.svg?label=web-documentation&style=for-the-badge)](https://torben.website/clientnode)
28
+
29
+ [![Try out](https://img.shields.io/badge/Try%20it%20on%20runkit-%2345cc11?style=for-the-badge)](https://npm.runkit.com/clientnode)
30
+
31
+ <!--|deDE:Einsatz-->
32
+ Use case
33
+ --------
34
+
35
+ The main goal of This plugin is providing an generic interface logic like
36
+ controller for calling instance methods or getting property values of an object
37
+ orientated designed plugin. A set of reusable logic elements for building gui
38
+ components is integrated as well.
39
+ <!--deDE:
40
+ Hauptziel dieses Plugins ist es einen generischen Weg zu bieten indem
41
+ Objekt Orientierte Plugins verfasst werden können, ohne dabei gegen
42
+ jQuery's Vorgaben an Plugins zu verstoßen.
43
+ Desweiteren werden einige wiederverwendbare Logikbausteine zum Bau
44
+ verschiedener GUI-Komponenten mitgeliefert.
45
+ -->
46
+
47
+ <!--Place for automatic generated table of contents.-->
48
+ <div class="doc-toc" style="display:none">
49
+ <!--|deDE:Inhalt-->
50
+ <h2 id="content">Content</h2>
51
+ </div>
52
+
53
+ <!--|deDE:Merkmale-->
54
+ Features
55
+ --------
56
+
57
+ <ul>
58
+ <li>
59
+ Mutual exclusion support through locking management
60
+ <!--deDE:Wechselseitiger Ausschluss durch Lock-Management-->
61
+ </li>
62
+ <li>
63
+ Cross browser logging with different log levels
64
+ <!--deDE:
65
+ Browserübergreifender Log-Mechanismen mit diversen Log-Levels
66
+ -->
67
+ </li>
68
+ <li>
69
+ Extending native JavaScript types like strings, arrays or functions
70
+ <!--deDE:
71
+ Erweiterung der Standard-JavaScript-Typen wie Strings, Arrays und
72
+ Funktionen
73
+ -->
74
+ </li>
75
+ <li>
76
+ A set of helper functions to parse option objects
77
+ <!--deDE:Hilfsfunktionen um Options-Objekte intelligent zu parsen-->
78
+ </li>
79
+ <li>
80
+ Extended dom tree handling.<!--deDE:Erweitertes DOM-Baum-Management-->
81
+ </li>
82
+ <li>
83
+ Plugin scoped event handling.
84
+ <!--deDE:Plugineigene Namensräume für Events.-->
85
+ </li>
86
+ <li>
87
+ Generic none-redundant plugin pattern for JavaScript and CoffeeScript
88
+ <!--deDE:Generischer Plugin-Muster für JavaScript und CoffeeScript-->
89
+ </li>
90
+ </ul>
91
+
92
+ <!--|deDE:Installation-->
93
+ Installation
94
+ ------------
95
+
96
+ ```bash
97
+ >>> curl \
98
+ https://raw.githubusercontent.com/thaibault/archinstall/main/archinstall.sh >archinstall.sh && \
99
+ chmod +x archinstall.sh
100
+ ```
101
+
102
+ ### Executable code example
103
+
104
+ <!--showExample-->
105
+
106
+ ```HTML
107
+ <label>
108
+ Name:
109
+ <input type="text" placeholder="Max Musterman" />
110
+ </label>
111
+ ```
112
+
113
+ <!--|deDE:Klassische Dom-Integration-->
114
+ ### Classical dom injection
115
+
116
+ You can simply download the compiled version as zip file here and inject it
117
+ after needed dependencies:
118
+ <!--deDE:
119
+ Du kannst einfach das Plugin als Zip-Archiv herunterladen und per
120
+ Script-Tag in deine Webseite integrieren:
121
+ -->
122
+
123
+ ```HTML
124
+ <script
125
+ src="https://code.jquery.com/jquery-3.6.0.min.js"
126
+ integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
127
+ crossorigin="anonymous"
128
+ ></script>
129
+ <!--Inject downloaded file:
130
+ <script src="index.js"></script>
131
+ -->
132
+ <!--Or integrate via cdn:-->
133
+ <script
134
+ src="https://torben.website/clientnode/data/distributionBundle/index.js"
135
+ ></script>
136
+ ```
137
+
138
+ The compiled bundle supports AMD, commonjs, commonjs2 and variable injection
139
+ into given context (UMD) as export format: You can use a module bundler if you
140
+ want.
141
+ <!--deDE:
142
+ Das kompilierte Bundle unterstützt AMD, commonjs, commonjs2 und
143
+ Variable-Injection in den gegebenen Context (UMD) als Export-Format:
144
+ Dadurch können verschiedene Module-Bundler genutzt werden.
145
+ -->
146
+
147
+ <!--|deDE:Paket-Management und Modul-Komposition-->
148
+ ### Package managed and module bundled
149
+
150
+ If you are using npm as package manager you can simply add this tool to your
151
+ **package.json** as dependency:
152
+ <!--deDE:
153
+ Nutzt du npm als Paket-Manager, dann solltest du einfach deine
154
+ <strong>package.json</strong> erweitern:
155
+ -->
156
+
157
+ ```JSON
158
+ ...
159
+ "dependencies": {
160
+ ...
161
+ "clientnode": "latest",
162
+ ...
163
+ },
164
+ ...
165
+ ```
166
+
167
+ After updating your packages you can simply depend on this script and let
168
+ a module bundler do the hard stuff or access it via an exported variable name
169
+ in given context.
170
+ <!--deDE:
171
+ Nach einem Update deiner Pakete kannst du dieses Plugin einfach in deine
172
+ JavaScript-Module importieren oder die exportierte Variable im gegebenen
173
+ Context referenzieren.
174
+ -->
175
+
176
+ ```JavaScript
177
+ ...
178
+ import Tools from 'clientnode'
179
+ clas Plugin extends Tools...
180
+ Tools({logging: true}).log('test') // shows "test" in console
181
+ // or
182
+ import {$} from 'clientnode'
183
+ $.Tools().isEquivalentDom('<div>', '<script>') // false
184
+ // or
185
+ {makeArray} = require('clientnode').default
186
+ makeArray(2) // [2]
187
+ // or
188
+ $ = require('clientnode').$
189
+ $.Tools().isEquivalentDom('<div>', '<script>') // false
190
+ ...
191
+ ```
192
+
193
+ <!--|deDE:Plugin-Vorlage-->
194
+ Plugin pattern
195
+ --------------
196
+
197
+ Use as extension for object orientated, node and browser compatible (optionally
198
+ jQuery) plugin using inheritance and dom node as return value reference. This
199
+ plugin pattern gives their instance back if no dom node is provided. Direct
200
+ initializing the plugin without providing a dom node is also provided.
201
+ Note: if you want to use it as jQuery (or another or even custom) plugin you
202
+ have to provide "$" globally before loading this module.
203
+ <!--deDE:
204
+ Einsatz von "$.Tools" um Objekt orientierte, node und Browser kompatible
205
+ (optional jQuery) Plugins zu implementieren, indem von "$.Tools" geerbt
206
+ wird und der durch jQuery erweiterte DOM-Knoten als return-Wert
207
+ referenziert wird. Sollte kein DOM-Knoten an die $-Funktion übergeben
208
+ worden sein, gibt dieser Pattern seine Instanz zurück.
209
+ Beachte: Wenn das Modul als jQuery (oder anderem potentiell eigenen) Plugin
210
+ einer bereits bestehenden Instanz hinzugefügt werden soll muss dieses unter
211
+ "$" global verfügbar sein bevor das Modul geladen wird.
212
+ -->
213
+
214
+ ```JavaScript
215
+ 'use strict'
216
+ import {$} from 'clientnode'
217
+ /**
218
+ * This plugin holds all needed methods to extend input fields to select
219
+ * numbers very smart.
220
+ * @extends clientnode:Tools
221
+ * @property static:_name - Defines this class name to allow retrieving them
222
+ * after name mangling.
223
+ * @property _options - Options extended by the options given to the
224
+ * initializer method.
225
+ */
226
+ export default class Example extends $.Tools.class {
227
+ static _name = 'Example';
228
+ /* eslint-disable jsdoc/require-description-complete-sentence */
229
+ /**
230
+ * Initializes the plugin. Later needed dom nodes are grabbed.
231
+ * @param options - An options object.
232
+ * @returns Returns $'s extended current dom node.
233
+ */
234
+ initialize(options = {}) {
235
+ /* eslint-enable jsdoc/require-description-complete-sentence */
236
+ this._options = {/*Default options here*/}
237
+ super.initialize(options)
238
+ return this.$domNode
239
+ }
240
+ }
241
+ $.fn.Example = function() {
242
+ return $.Tools().controller(Example, arguments, this)
243
+ }
244
+ ```
245
+
246
+ Initialisation with given dom node and without:
247
+ <!--deDE:Aufruf mit und ohne übergebenen DOM-Knoten:-->
248
+
249
+ ```JavaScript
250
+ const $domNode = $('#domNode').Example({firstOption: 'value'});
251
+ const exampleInstance = $.Example({firstOption: 'value'});
252
+ ```
253
+
254
+ Function call from previous generated instance via dom node or instance
255
+ reference:
256
+ <!--deDE:
257
+ Aufruf einer Plugin-Methode anhand der zuvor generierten Instanz bzw. über
258
+ den zurückgegebene DOM-Knoten:
259
+ -->
260
+
261
+ ```JavaScript
262
+ const returnValue = $('#domNode').Example('method', 'anArgument')
263
+ const returnValue = $('#domNode').Example().method('anArgument')
264
+ const exampleInstance = $.Example({firstOption: 'value'})
265
+ const returnValue = exampleInstance.method('anArgument')
266
+ ```
Binary file
Binary file
Binary file
Binary file
Binary file