@startinblox/core 0.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 (157) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/dist/_snowpack/pkg/autolinker.js +4429 -0
  4. package/dist/_snowpack/pkg/autolinker.js.map +1 -0
  5. package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js +353 -0
  6. package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js.map +1 -0
  7. package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js +26 -0
  8. package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
  9. package/dist/_snowpack/pkg/common/decode-26fbf385.js +185 -0
  10. package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
  11. package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
  12. package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
  13. package/dist/_snowpack/pkg/delta-markdown-for-quill.js +26198 -0
  14. package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -0
  15. package/dist/_snowpack/pkg/dialog-polyfill.js +827 -0
  16. package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -0
  17. package/dist/_snowpack/pkg/fusejs.js +1593 -0
  18. package/dist/_snowpack/pkg/fusejs.js.map +1 -0
  19. package/dist/_snowpack/pkg/import-map.json +24 -0
  20. package/dist/_snowpack/pkg/jsonld-context-parser.js +836 -0
  21. package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -0
  22. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +640 -0
  23. package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +10 -0
  24. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +60 -0
  25. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +10 -0
  26. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -0
  27. package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +10 -0
  28. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +39 -0
  29. package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -0
  30. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +48 -0
  31. package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -0
  32. package/dist/_snowpack/pkg/lit-html/directives/until.js +87 -0
  33. package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -0
  34. package/dist/_snowpack/pkg/lit-html.js +94 -0
  35. package/dist/_snowpack/pkg/lit-html.js.map +1 -0
  36. package/dist/_snowpack/pkg/markdown-it-link-attributes.js +68 -0
  37. package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -0
  38. package/dist/_snowpack/pkg/markdown-it.js +11307 -0
  39. package/dist/_snowpack/pkg/markdown-it.js.map +1 -0
  40. package/dist/_snowpack/pkg/quill/dist/quill.snow.css +945 -0
  41. package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +10 -0
  42. package/dist/_snowpack/pkg/quill-delta-to-markdown.js +971 -0
  43. package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -0
  44. package/dist/_snowpack/pkg/quill.js +14442 -0
  45. package/dist/_snowpack/pkg/quill.js.map +1 -0
  46. package/dist/_snowpack/pkg/slim-select.js +714 -0
  47. package/dist/_snowpack/pkg/slim-select.js.map +1 -0
  48. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1149 -0
  49. package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +10 -0
  50. package/dist/_snowpack/pkg/tui-calendar.js +46507 -0
  51. package/dist/_snowpack/pkg/tui-calendar.js.map +1 -0
  52. package/dist/components/solid-ac-checker.js +45 -0
  53. package/dist/components/solid-calendar.js +66 -0
  54. package/dist/components/solid-delete.js +96 -0
  55. package/dist/components/solid-display.js +150 -0
  56. package/dist/components/solid-form-search.js +177 -0
  57. package/dist/components/solid-form.js +259 -0
  58. package/dist/components/solid-lang.js +35 -0
  59. package/dist/components/solid-map.js +204 -0
  60. package/dist/components/solid-table.js +181 -0
  61. package/dist/components/solid-widget.js +72 -0
  62. package/dist/import.css +4 -0
  63. package/dist/index.js +49 -0
  64. package/dist/libs/Component.js +13 -0
  65. package/dist/libs/ComponentFactory.js +168 -0
  66. package/dist/libs/Compositor.js +96 -0
  67. package/dist/libs/Sib.js +44 -0
  68. package/dist/libs/filter.js +184 -0
  69. package/dist/libs/helpers.js +194 -0
  70. package/dist/libs/interfaces.js +6 -0
  71. package/dist/libs/lit-helpers.js +142 -0
  72. package/dist/libs/polyfills.js +37 -0
  73. package/dist/libs/store/server-pagination.js +22 -0
  74. package/dist/libs/store/server-search.js +35 -0
  75. package/dist/libs/store/store.js +814 -0
  76. package/dist/locales/en.json +10 -0
  77. package/dist/locales/en.json.proxy.js +2 -0
  78. package/dist/locales/fr.json +10 -0
  79. package/dist/locales/fr.json.proxy.js +2 -0
  80. package/dist/mixins/attributeBinderMixin.js +116 -0
  81. package/dist/mixins/contextMixin.js +26 -0
  82. package/dist/mixins/counterMixin.js +54 -0
  83. package/dist/mixins/federationMixin.js +51 -0
  84. package/dist/mixins/filterMixin.js +155 -0
  85. package/dist/mixins/grouperMixin.js +73 -0
  86. package/dist/mixins/highlighterMixin.js +36 -0
  87. package/dist/mixins/interfaces.js +6 -0
  88. package/dist/mixins/listMixin.js +105 -0
  89. package/dist/mixins/nextMixin.js +23 -0
  90. package/dist/mixins/paginateMixin.js +97 -0
  91. package/dist/mixins/requiredMixin.js +26 -0
  92. package/dist/mixins/serverPaginationMixin.js +122 -0
  93. package/dist/mixins/sorterMixin.js +131 -0
  94. package/dist/mixins/storeMixin.js +109 -0
  95. package/dist/mixins/translationMixin.js +58 -0
  96. package/dist/mixins/validationMixin.js +95 -0
  97. package/dist/mixins/widgetMixin.js +351 -0
  98. package/dist/new-widgets/attributeMixins/actionMixin.js +13 -0
  99. package/dist/new-widgets/attributeMixins/blankMixin.js +7 -0
  100. package/dist/new-widgets/attributeMixins/booleanMixin.js +7 -0
  101. package/dist/new-widgets/attributeMixins/index.js +19 -0
  102. package/dist/new-widgets/attributeMixins/mailtoMixin.js +7 -0
  103. package/dist/new-widgets/attributeMixins/multipleMixin.js +27 -0
  104. package/dist/new-widgets/attributeMixins/numberMixin.js +7 -0
  105. package/dist/new-widgets/attributeMixins/placeholderMixin.js +16 -0
  106. package/dist/new-widgets/attributeMixins/telMixin.js +7 -0
  107. package/dist/new-widgets/baseWidgetMixin.js +109 -0
  108. package/dist/new-widgets/callbackMixins/autocompletionMixin.js +96 -0
  109. package/dist/new-widgets/callbackMixins/index.js +7 -0
  110. package/dist/new-widgets/callbackMixins/richtextMixin.js +37 -0
  111. package/dist/new-widgets/callbackMixins/slimselect.css +2 -0
  112. package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +10 -0
  113. package/dist/new-widgets/interfaces.js +1 -0
  114. package/dist/new-widgets/new-widget-factory.js +91 -0
  115. package/dist/new-widgets/templateAdditionMixins/addableMixin.js +26 -0
  116. package/dist/new-widgets/templateAdditionMixins/index.js +13 -0
  117. package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +16 -0
  118. package/dist/new-widgets/templateAdditionMixins/labelMixin.js +18 -0
  119. package/dist/new-widgets/templates/defaultTemplatesDirectory.js +29 -0
  120. package/dist/new-widgets/templates/displayTemplatesDirectory.js +54 -0
  121. package/dist/new-widgets/templates/formTemplatesDirectory.js +432 -0
  122. package/dist/new-widgets/templates/groupTemplatesDirectory.js +11 -0
  123. package/dist/new-widgets/templates/index.js +6 -0
  124. package/dist/new-widgets/templates/setTemplatesDirectory.js +16 -0
  125. package/dist/new-widgets/templatesDependencies/altMixin.js +12 -0
  126. package/dist/new-widgets/templatesDependencies/editableMixin.js +60 -0
  127. package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +34 -0
  128. package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +10 -0
  129. package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +41 -0
  130. package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +56 -0
  131. package/dist/new-widgets/templatesDependencies/formFileMixin.js +82 -0
  132. package/dist/new-widgets/templatesDependencies/formLengthMixin.js +18 -0
  133. package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +18 -0
  134. package/dist/new-widgets/templatesDependencies/formMixin.js +56 -0
  135. package/dist/new-widgets/templatesDependencies/formNumberMixin.js +10 -0
  136. package/dist/new-widgets/templatesDependencies/formRadioMixin.js +12 -0
  137. package/dist/new-widgets/templatesDependencies/formStepMixin.js +12 -0
  138. package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
  139. package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +112 -0
  140. package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +65 -0
  141. package/dist/new-widgets/templatesDependencies/patternMixin.js +18 -0
  142. package/dist/new-widgets/templatesDependencies/rangeMixin.js +100 -0
  143. package/dist/new-widgets/templatesDependencies/setMixin.js +9 -0
  144. package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +9 -0
  145. package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +14 -0
  146. package/dist/new-widgets/valueTransformationMixins/dateMixin.js +29 -0
  147. package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +12 -0
  148. package/dist/new-widgets/valueTransformationMixins/index.js +15 -0
  149. package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +30 -0
  150. package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +13 -0
  151. package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +21 -0
  152. package/dist/solid-template-element.js +144 -0
  153. package/dist/style/default-theme.css +24 -0
  154. package/dist/style/default-theme.css.proxy.js +10 -0
  155. package/dist/widgets/baseWidget.js +268 -0
  156. package/dist/widgets/widget-factory.js +22 -0
  157. package/package.json +117 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Startin blox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # Getting started
2
+
3
+ > Please before to start, check [our contribution guidelines](https://git.startinblox.com/documentation/doc/wikis/Contribution-guidelines):)
4
+
5
+ This documentation is for developers who would like to contribute to the core of the framework.
6
+
7
+ **If you just want to use the framework, please refer to [the general documentation](https://docs.startinblox.com).**
8
+
9
+ ## Installation
10
+ To start developing in `sib-core`, you need:
11
+ ```shell
12
+ # 1. Install the dependencies
13
+ npm install
14
+
15
+ # 2. Build the framework
16
+ npm run build:dev
17
+
18
+ # 3. Launch a web server
19
+ npm run serve
20
+ ```
21
+
22
+ You can now see examples at [http://127.0.0.1:3000](http://127.0.0.1:3000/).
23
+
24
+ ## Adding new features
25
+ To develop new features of `sib-core`, you can add an HTML example file in `/examples` and link it in `/index.html`.
26
+ Don't forget to import the framework:
27
+
28
+ ```html
29
+ <script type="module" src="../dist/index.js"></script>
30
+ ```
31
+ You can now write HTML using `sib-core` and test it in your browser.
32
+
33
+
34
+ ## Test
35
+ You can test the API by running:
36
+ ```shell
37
+ npm run test
38
+ ```
39
+
40
+ # Mixin API
41
+ ## How it works
42
+ Here is a simplified schema of how the API works to create a component:
43
+ ![sib-api](./images-documentation/sib-api.png)
44
+
45
+ ## Name
46
+
47
+ ```js
48
+ static get name() {
49
+ return 'string';
50
+ }
51
+ ```
52
+ The static getter "name" return a string that will be used to register the component tag name or the mixin name. This getter is required.
53
+
54
+ ## Install mixins
55
+ ```js
56
+ static get use() {
57
+ return [Mixin];
58
+ }
59
+ ```
60
+
61
+ The static getter "use" return an array of mixins to install. The mixin compositor install mixin recursively.
62
+
63
+ ## Declare attributes
64
+ ```js
65
+ static get attributes() {
66
+ return {
67
+ myProp: {
68
+ type: String,
69
+ default: '',
70
+ callback(newValue, oldValue) {
71
+ //
72
+ },
73
+ required: false,
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ To declare an attribute, you should use the static getter "attributes". It should return an object. Each property will be bind with kebab case equivalent. Example: 'myProp' is bound to 'my-prop'. Each property should be an object with :
80
+ - type
81
+ - description: The js type of your attribute data
82
+ - required: false
83
+ - default: String
84
+ - default
85
+ - description: A default value
86
+ - required: false
87
+ - default: undefined
88
+ - required
89
+ - description: Is this attribute required, if true, throw an Error if not provided
90
+ - required: false
91
+ - default: false
92
+ - callback
93
+ - description: A function that will be invoke when the attribute changed. It receive 2 arguments : newValue, oldValue.
94
+ - required: false
95
+ - default: undefined
96
+
97
+ The mixin compositor register all attribute recursively. The last declaration is keeped.
98
+
99
+ ## Declare initial state
100
+ ```js
101
+ static get initialState() {
102
+ return {
103
+ click: 0,
104
+ };
105
+ }
106
+ ```
107
+ The static getter initialState should return an object that contains initial state of the component. The mixin compositor merge recursively the initial state. Last declaration is keeped.
108
+ Every property in the initial state could be watched by the component in order to provide reactivity.
109
+
110
+
111
+ ## Hooks
112
+ ```js
113
+ created() {
114
+ console.log('component is created');
115
+ }
116
+ ```
117
+ Available hook:
118
+ - created
119
+ - attached
120
+ - detached
121
+
122
+ Each hook is a function. The mixin compositor *append* hooks. If a deeper mixin register a created hook, its function will be called before the current created hook.
123
+
124
+ ## Declare methods
125
+ ```js
126
+ myMethod() {
127
+ console.log('Hi!');
128
+ }
129
+ ```
130
+ In order to declare methods, you just add a method to your mixin. The mixin compositor keep the last method declared.
131
+
132
+ # Core Architecture
133
+ Here is a simplified schema of the organization and the responsibilities of the classes of the core:
134
+ ![core-architecture](./images-documentation/core-architecture.png)
135
+
136
+ ## List post-processing
137
+ A `solid-display` component is capable of showing a list of resources and applying different filters on this list to filter, sort, group... resources. Here is a schema of the order of these transformations:
138
+ ![list-post-processing](./images-documentation/list-post-processing.png)
139
+
140
+ # Widgets API
141
+ A widget is a small component responsible for a value. The widget is composed and built on demand when the developer ask for it.
142
+ To do that, the name of the widget is splitted and analyzed to add the right mixins. Here is a schema of how it works:
143
+
144
+ ![widget-api](./images-documentation/widget-api.png)
145
+
146
+ ## Values
147
+ Values are given to a widget through its `value` attribute. For the widgets defined by sib-core, it can have different types:
148
+ - `string`: most common and encouraged use case
149
+ - `boolean` (checkbox): is converted to string (`'true'` or `'false'`)
150
+ - `number` (input number): is converted to string
151
+ - `container` (multiple, multiple form): is converted to `@id` and resolved by the widget
152
+
153
+ As custom widgets still use the old API, you can give them these types:
154
+ - `string`
155
+ - `resource` Proxy
156
+ - `container` Proxy
157
+
158
+ ### Get the values
159
+ With the display widgets, you can get the value through its HTML attribute:
160
+ ```js
161
+ const value = widgetElement.getAttribute('value');
162
+ // or thanks to the core API
163
+ const value = widgetElement.component.value;
164
+ ```
165
+
166
+ In the form widgets, the value can be changed by the user. If you need to retrieve it, proceed like this:
167
+ ```js
168
+ const value = widgetElement.component.getValue();
169
+ ```
170
+
171
+ Under the hood, the core finds elements which have a `data-holder` attribute, and get the value from their properties, instead of their attribute (where you would have the initial value of the widget).
172
+
173
+ A widget can have:
174
+ - 1 `data-holder` element (simple inputs)
175
+ - 2 `data-holder` elements (range filter inputs)
176
+ - multiple `data-holder` elements (multiple-form)
177
+
178
+
179
+ ## Not clear enough ?
180
+ Help us to improve the documentation! Feel free to ask for clarification or ask questions. This helps us to improve our documentation.
181
+
182
+ Thanks you!