@startinblox/boilerplate 3.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 (54) hide show
  1. package/.gitlab-ci.yml +57 -0
  2. package/.storybook/main.ts +15 -0
  3. package/.storybook/preview-head.html +8 -0
  4. package/.storybook/preview.ts +22 -0
  5. package/LICENSE +21 -0
  6. package/README.md +85 -0
  7. package/biome.json +39 -0
  8. package/cypress/component/solid-boilerplate.cy.ts +9 -0
  9. package/cypress/cypress.d.ts +1 -0
  10. package/cypress/support/component-index.html +12 -0
  11. package/cypress/support/component.ts +17 -0
  12. package/cypress.config.ts +11 -0
  13. package/dist/boilerplate.css +1 -0
  14. package/dist/index.js +1213 -0
  15. package/lit-localize.json +15 -0
  16. package/locales/en.xlf +13 -0
  17. package/package.json +92 -0
  18. package/postcss.config.js +8 -0
  19. package/src/component.d.ts +161 -0
  20. package/src/components/solid-boilerplate.ts +79 -0
  21. package/src/components/ui/sample-object.ts +37 -0
  22. package/src/components/ui/sample-objects.ts +40 -0
  23. package/src/context.json +1 -0
  24. package/src/helpers/components/componentObjectHandler.ts +100 -0
  25. package/src/helpers/components/componentObjectsHandler.ts +44 -0
  26. package/src/helpers/components/orbitComponent.ts +241 -0
  27. package/src/helpers/components/setupCacheInvalidation.ts +37 -0
  28. package/src/helpers/components/setupCacheOnResourceReady.ts +32 -0
  29. package/src/helpers/components/setupComponentSubscriptions.ts +73 -0
  30. package/src/helpers/components/setupOnSaveReset.ts +20 -0
  31. package/src/helpers/datas/dataBuilder.ts +43 -0
  32. package/src/helpers/datas/filterGenerator.ts +29 -0
  33. package/src/helpers/datas/filterObjectByDateAfter.ts +80 -0
  34. package/src/helpers/datas/filterObjectById.ts +54 -0
  35. package/src/helpers/datas/filterObjectByInterval.ts +133 -0
  36. package/src/helpers/datas/filterObjectByNamedValue.ts +103 -0
  37. package/src/helpers/datas/filterObjectByType.ts +30 -0
  38. package/src/helpers/datas/filterObjectByValue.ts +81 -0
  39. package/src/helpers/datas/sort.ts +40 -0
  40. package/src/helpers/i18n/configureLocalization.ts +17 -0
  41. package/src/helpers/index.ts +41 -0
  42. package/src/helpers/ui/formatDate.ts +18 -0
  43. package/src/helpers/ui/lipsum.ts +12 -0
  44. package/src/helpers/utils/requestNavigation.ts +12 -0
  45. package/src/helpers/utils/uniq.ts +6 -0
  46. package/src/index.ts +7 -0
  47. package/src/initializer.ts +11 -0
  48. package/src/mocks/orbit.mock.ts +33 -0
  49. package/src/mocks/user.mock.ts +67 -0
  50. package/src/styles/component-sample.scss +4 -0
  51. package/src/styles/index.scss +16 -0
  52. package/stories/sample-objects.stories.ts +47 -0
  53. package/tsconfig.json +36 -0
  54. package/vite.config.ts +44 -0
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,57 @@
1
+ ---
2
+ include:
3
+ project: infra/gitlab
4
+ ref: master
5
+ file: templates/nodejs.ci.yml
6
+
7
+ cache:
8
+ key: ${CI_COMMIT_REF_SLUG}
9
+ paths:
10
+ - .npm/
11
+
12
+ default:
13
+ image: node:22
14
+
15
+ stages:
16
+ - prepare
17
+ - test
18
+ - publish
19
+
20
+ prepare:
21
+ stage: prepare
22
+ image: node:22
23
+ before_script:
24
+ - npm ci --cache .npm --prefer-offline
25
+ - npm install -g semantic-release@24 @semantic-release/gitlab@13
26
+ script:
27
+ - npm run locale:build
28
+ - npm run build
29
+ artifacts:
30
+ when: on_success
31
+ paths:
32
+ - dist
33
+ expire_in: 1 day
34
+ tags:
35
+ - test
36
+
37
+ test:
38
+ stage: test
39
+ image:
40
+ name: cypress/included:14.2.0
41
+ entrypoint: [""]
42
+ before_script:
43
+ - npm ci --cache .npm --prefer-offline
44
+ script:
45
+ - npm run cy:run
46
+ except:
47
+ - tags
48
+ tags:
49
+ - test
50
+
51
+ publish:
52
+ stage: publish
53
+ extends: .publish_npm
54
+ only:
55
+ - master
56
+ - beta
57
+ - alpha
@@ -0,0 +1,15 @@
1
+ import type { StorybookConfig } from "@storybook/web-components-vite";
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ["../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5
+ addons: ["@storybook/addon-essentials"],
6
+ framework: {
7
+ name: "@storybook/web-components-vite",
8
+ options: {},
9
+ },
10
+ docs: {
11
+ autodocs: "tag",
12
+ },
13
+ };
14
+
15
+ export default config;
@@ -0,0 +1,8 @@
1
+ <script>
2
+ window.global = window;
3
+ </script>
4
+ <style>
5
+ .sbdocs.sbdocs-content {
6
+ max-width: 1440px;
7
+ }
8
+ </style>
@@ -0,0 +1,22 @@
1
+ import type { Preview } from "@storybook/web-components";
2
+
3
+ import "@styles/index.scss";
4
+
5
+ import "@mocks/orbit.mock";
6
+
7
+ const preview: Preview = {
8
+ parameters: {
9
+ actions: { argTypesRegex: "^on[A-Z].*" },
10
+ controls: {
11
+ matchers: {
12
+ color: /(background|color)$/i,
13
+ date: /Date$/i,
14
+ },
15
+ },
16
+ docs: {
17
+ toc: true,
18
+ },
19
+ },
20
+ };
21
+
22
+ export default preview;
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-PRESENT 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,85 @@
1
+ # Boilerplate
2
+
3
+ ## Table of Contents
4
+
5
+ 1. [Introduction](#introduction)
6
+ 2. [Installation](#installation)
7
+ 3. [Development](#development)
8
+ 4. [Tests](#tests)
9
+ 5. [Storybook](#storybook)
10
+ 6. [Build](#build)
11
+ 7. [License](#license)
12
+
13
+ ## Introduction
14
+
15
+ This is a boilerplate of startin'blox component.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install
21
+ ```
22
+
23
+ ## Development
24
+
25
+ ```bash
26
+ npm run watch
27
+ ```
28
+
29
+ ## Tests
30
+
31
+ ```bash
32
+ npm run cy:run
33
+ ```
34
+
35
+ or
36
+
37
+ ```bash
38
+ npm run cy:open
39
+ ```
40
+
41
+ ## Storybook
42
+
43
+ ```bash
44
+ npm run storybook
45
+ ```
46
+
47
+ ## Build
48
+
49
+ ```bash
50
+ npm run build
51
+ ```
52
+
53
+ ## Localization
54
+
55
+ This project uses [`@lit/localize`](https://www.npmjs.com/package/@lit/localize) for internationalization.
56
+
57
+ ### Extracting strings
58
+
59
+ To extract strings for translation, run:
60
+
61
+ ```bash
62
+ npm run locale:extract
63
+ ```
64
+
65
+ This command will generate XLIFF files in the `locales` directory.
66
+
67
+ ### Changing locale
68
+
69
+ To change the locale, run:
70
+
71
+ ```javascript
72
+ window.setLocale.map((setLocale) => setLocale("your-lang-code"));
73
+ ```
74
+
75
+ ### Getting current locale
76
+
77
+ To get the current locale, run:
78
+
79
+ ```javascript
80
+ window.getLocale.map((locale) => console.log(locale));
81
+ ```
82
+
83
+ ## License
84
+
85
+ [MIT](LICENSE)
package/biome.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "ignoreUnknown": false,
10
+ "ignore": []
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space"
15
+ },
16
+ "organizeImports": {
17
+ "enabled": true
18
+ },
19
+ "linter": {
20
+ "enabled": true,
21
+ "rules": {
22
+ "recommended": true,
23
+ "complexity": {
24
+ "useLiteralKeys": "off"
25
+ },
26
+ "suspicious": {
27
+ "noExplicitAny": "off"
28
+ }
29
+ }
30
+ },
31
+ "javascript": {
32
+ "formatter": {
33
+ "quoteStyle": "double",
34
+ "semicolons": "always",
35
+ "indentStyle": "space",
36
+ "indentWidth": 2
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,9 @@
1
+ import { html } from "lit";
2
+
3
+ describe("<solid-boilerplate>", () => {
4
+ it("should mount", () => {
5
+ cy.mount(html`<solid-boilerplate></solid-boilerplate>`);
6
+
7
+ cy.get("solid-boilerplate").should("exist");
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ /// <reference types="cypress" />
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
+ <title>Components App</title>
8
+ </head>
9
+ <body>
10
+ <div data-cy-root></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,17 @@
1
+ import { mount } from "cypress-ct-lit";
2
+ import "/src/index.ts";
3
+
4
+ declare global {
5
+ namespace Cypress {
6
+ interface Chainable {
7
+ /**
8
+ * Mount your template/component into Cypress sandbox
9
+ * @param template
10
+ * @param options render options for custom rendering
11
+ */
12
+ mount: typeof mount;
13
+ }
14
+ }
15
+ }
16
+
17
+ Cypress.Commands.add("mount", mount);
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from "cypress";
2
+
3
+ export default defineConfig({
4
+ component: {
5
+ includeShadowDom: true,
6
+ devServer: {
7
+ framework: "cypress-ct-lit",
8
+ bundler: "vite",
9
+ },
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ @import"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap";:root{--font-family:"Inter",sans-serif;--color-text:#181d27;--color-primary:#001aff;--color-secondary:#001aff;--color-third:#e4f0ff;--color-heading:#181d27;font-family:var(--font-family)}