@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.
- package/LICENSE +21 -0
- package/README.md +182 -0
- package/dist/_snowpack/pkg/autolinker.js +4429 -0
- package/dist/_snowpack/pkg/autolinker.js.map +1 -0
- package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js +353 -0
- package/dist/_snowpack/pkg/common/_baseUnary-c1edb653.js.map +1 -0
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js +26 -0
- package/dist/_snowpack/pkg/common/_commonjsHelpers-37fa8da4.js.map +1 -0
- package/dist/_snowpack/pkg/common/decode-26fbf385.js +185 -0
- package/dist/_snowpack/pkg/common/decode-26fbf385.js.map +1 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js +1104 -0
- package/dist/_snowpack/pkg/common/lit-html-3647afce.js.map +1 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js +26198 -0
- package/dist/_snowpack/pkg/delta-markdown-for-quill.js.map +1 -0
- package/dist/_snowpack/pkg/dialog-polyfill.js +827 -0
- package/dist/_snowpack/pkg/dialog-polyfill.js.map +1 -0
- package/dist/_snowpack/pkg/fusejs.js +1593 -0
- package/dist/_snowpack/pkg/fusejs.js.map +1 -0
- package/dist/_snowpack/pkg/import-map.json +24 -0
- package/dist/_snowpack/pkg/jsonld-context-parser.js +836 -0
- package/dist/_snowpack/pkg/jsonld-context-parser.js.map +1 -0
- package/dist/_snowpack/pkg/leaflet/dist/leaflet.css +640 -0
- package/dist/_snowpack/pkg/leaflet/dist/leaflet.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css +60 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.Default.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css +14 -0
- package/dist/_snowpack/pkg/leaflet.markercluster/dist/MarkerCluster.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js +39 -0
- package/dist/_snowpack/pkg/lit-html/directives/if-defined.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js +48 -0
- package/dist/_snowpack/pkg/lit-html/directives/unsafe-html.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html/directives/until.js +87 -0
- package/dist/_snowpack/pkg/lit-html/directives/until.js.map +1 -0
- package/dist/_snowpack/pkg/lit-html.js +94 -0
- package/dist/_snowpack/pkg/lit-html.js.map +1 -0
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js +68 -0
- package/dist/_snowpack/pkg/markdown-it-link-attributes.js.map +1 -0
- package/dist/_snowpack/pkg/markdown-it.js +11307 -0
- package/dist/_snowpack/pkg/markdown-it.js.map +1 -0
- package/dist/_snowpack/pkg/quill/dist/quill.snow.css +945 -0
- package/dist/_snowpack/pkg/quill/dist/quill.snow.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js +971 -0
- package/dist/_snowpack/pkg/quill-delta-to-markdown.js.map +1 -0
- package/dist/_snowpack/pkg/quill.js +14442 -0
- package/dist/_snowpack/pkg/quill.js.map +1 -0
- package/dist/_snowpack/pkg/slim-select.js +714 -0
- package/dist/_snowpack/pkg/slim-select.js.map +1 -0
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css +1149 -0
- package/dist/_snowpack/pkg/tui-calendar/dist/tui-calendar.css.proxy.js +10 -0
- package/dist/_snowpack/pkg/tui-calendar.js +46507 -0
- package/dist/_snowpack/pkg/tui-calendar.js.map +1 -0
- package/dist/components/solid-ac-checker.js +45 -0
- package/dist/components/solid-calendar.js +66 -0
- package/dist/components/solid-delete.js +96 -0
- package/dist/components/solid-display.js +150 -0
- package/dist/components/solid-form-search.js +177 -0
- package/dist/components/solid-form.js +259 -0
- package/dist/components/solid-lang.js +35 -0
- package/dist/components/solid-map.js +204 -0
- package/dist/components/solid-table.js +181 -0
- package/dist/components/solid-widget.js +72 -0
- package/dist/import.css +4 -0
- package/dist/index.js +49 -0
- package/dist/libs/Component.js +13 -0
- package/dist/libs/ComponentFactory.js +168 -0
- package/dist/libs/Compositor.js +96 -0
- package/dist/libs/Sib.js +44 -0
- package/dist/libs/filter.js +184 -0
- package/dist/libs/helpers.js +194 -0
- package/dist/libs/interfaces.js +6 -0
- package/dist/libs/lit-helpers.js +142 -0
- package/dist/libs/polyfills.js +37 -0
- package/dist/libs/store/server-pagination.js +22 -0
- package/dist/libs/store/server-search.js +35 -0
- package/dist/libs/store/store.js +814 -0
- package/dist/locales/en.json +10 -0
- package/dist/locales/en.json.proxy.js +2 -0
- package/dist/locales/fr.json +10 -0
- package/dist/locales/fr.json.proxy.js +2 -0
- package/dist/mixins/attributeBinderMixin.js +116 -0
- package/dist/mixins/contextMixin.js +26 -0
- package/dist/mixins/counterMixin.js +54 -0
- package/dist/mixins/federationMixin.js +51 -0
- package/dist/mixins/filterMixin.js +155 -0
- package/dist/mixins/grouperMixin.js +73 -0
- package/dist/mixins/highlighterMixin.js +36 -0
- package/dist/mixins/interfaces.js +6 -0
- package/dist/mixins/listMixin.js +105 -0
- package/dist/mixins/nextMixin.js +23 -0
- package/dist/mixins/paginateMixin.js +97 -0
- package/dist/mixins/requiredMixin.js +26 -0
- package/dist/mixins/serverPaginationMixin.js +122 -0
- package/dist/mixins/sorterMixin.js +131 -0
- package/dist/mixins/storeMixin.js +109 -0
- package/dist/mixins/translationMixin.js +58 -0
- package/dist/mixins/validationMixin.js +95 -0
- package/dist/mixins/widgetMixin.js +351 -0
- package/dist/new-widgets/attributeMixins/actionMixin.js +13 -0
- package/dist/new-widgets/attributeMixins/blankMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/booleanMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/index.js +19 -0
- package/dist/new-widgets/attributeMixins/mailtoMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/multipleMixin.js +27 -0
- package/dist/new-widgets/attributeMixins/numberMixin.js +7 -0
- package/dist/new-widgets/attributeMixins/placeholderMixin.js +16 -0
- package/dist/new-widgets/attributeMixins/telMixin.js +7 -0
- package/dist/new-widgets/baseWidgetMixin.js +109 -0
- package/dist/new-widgets/callbackMixins/autocompletionMixin.js +96 -0
- package/dist/new-widgets/callbackMixins/index.js +7 -0
- package/dist/new-widgets/callbackMixins/richtextMixin.js +37 -0
- package/dist/new-widgets/callbackMixins/slimselect.css +2 -0
- package/dist/new-widgets/callbackMixins/slimselect.css.proxy.js +10 -0
- package/dist/new-widgets/interfaces.js +1 -0
- package/dist/new-widgets/new-widget-factory.js +91 -0
- package/dist/new-widgets/templateAdditionMixins/addableMixin.js +26 -0
- package/dist/new-widgets/templateAdditionMixins/index.js +13 -0
- package/dist/new-widgets/templateAdditionMixins/labelLastMixin.js +16 -0
- package/dist/new-widgets/templateAdditionMixins/labelMixin.js +18 -0
- package/dist/new-widgets/templates/defaultTemplatesDirectory.js +29 -0
- package/dist/new-widgets/templates/displayTemplatesDirectory.js +54 -0
- package/dist/new-widgets/templates/formTemplatesDirectory.js +432 -0
- package/dist/new-widgets/templates/groupTemplatesDirectory.js +11 -0
- package/dist/new-widgets/templates/index.js +6 -0
- package/dist/new-widgets/templates/setTemplatesDirectory.js +16 -0
- package/dist/new-widgets/templatesDependencies/altMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/editableMixin.js +60 -0
- package/dist/new-widgets/templatesDependencies/filterRangeFormMixin.js +34 -0
- package/dist/new-widgets/templatesDependencies/formCheckboxMixin.js +10 -0
- package/dist/new-widgets/templatesDependencies/formCheckboxesMixin.js +41 -0
- package/dist/new-widgets/templatesDependencies/formDropdownMixin.js +56 -0
- package/dist/new-widgets/templatesDependencies/formFileMixin.js +82 -0
- package/dist/new-widgets/templatesDependencies/formLengthMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/formMinMaxMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/formMixin.js +56 -0
- package/dist/new-widgets/templatesDependencies/formNumberMixin.js +10 -0
- package/dist/new-widgets/templatesDependencies/formRadioMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/formStepMixin.js +12 -0
- package/dist/new-widgets/templatesDependencies/linkTextMixin.js +13 -0
- package/dist/new-widgets/templatesDependencies/multipleFormMixin.js +112 -0
- package/dist/new-widgets/templatesDependencies/multipleselectFormMixin.js +65 -0
- package/dist/new-widgets/templatesDependencies/patternMixin.js +18 -0
- package/dist/new-widgets/templatesDependencies/rangeMixin.js +100 -0
- package/dist/new-widgets/templatesDependencies/setMixin.js +9 -0
- package/dist/new-widgets/templatesDependencies/valueRichtextMixin.js +9 -0
- package/dist/new-widgets/valueTransformationMixins/autolinkMixin.js +14 -0
- package/dist/new-widgets/valueTransformationMixins/dateMixin.js +29 -0
- package/dist/new-widgets/valueTransformationMixins/dateTimeMixin.js +12 -0
- package/dist/new-widgets/valueTransformationMixins/index.js +15 -0
- package/dist/new-widgets/valueTransformationMixins/markdownMixin.js +30 -0
- package/dist/new-widgets/valueTransformationMixins/multilineMixin.js +13 -0
- package/dist/new-widgets/valueTransformationMixins/oembedMixin.js +21 -0
- package/dist/solid-template-element.js +144 -0
- package/dist/style/default-theme.css +24 -0
- package/dist/style/default-theme.css.proxy.js +10 -0
- package/dist/widgets/baseWidget.js +268 -0
- package/dist/widgets/widget-factory.js +22 -0
- 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
|
+

|
|
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
|
+

|
|
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
|
+

|
|
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
|
+

|
|
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!
|