@hkdigital/lib-sveltekit 0.2.20 → 0.2.22

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/README.md CHANGED
@@ -13,14 +13,6 @@ Do not use in production environments yet.
13
13
 
14
14
  ### TODO
15
15
 
16
- Add information about Skeleton, theming and imagetools
17
-
18
- ## A note about tailwindcss
19
-
20
- Components in this package use [tailwindcss](https://tailwindcss.com/).
21
-
22
- To compile tailwind classes inside this package, you must add the package location to your tailwindcss plugin configuration (instructions below).
23
-
24
16
  ## Using the library
25
17
 
26
18
  ### Install
@@ -31,37 +23,51 @@ The library can be installed as a normal NPM library.
31
23
  pnpm add @hkdigital/lib-sveltekit
32
24
  ```
33
25
 
34
- ### Update
26
+ #### Tailwind
35
27
 
36
- We use a global installion of the `ncu` package to upgrade our `package.json`. Install `ncu` first if you don't have it yet
28
+ Components in this package use [tailwindcss](https://tailwindcss.com/).
37
29
 
38
- ```bash
39
- npm install -g npm-check-updates
30
+ To compile tailwind classes inside this package, you must add the package location to your tailwindcss plugin configuration.
31
+
32
+ ```
33
+ // tailwind.config.js
34
+ export default {
35
+ content: [
36
+ './node_modules/@hkdigital/**/*.{html,js,svelte,ts}',
37
+ './src/**/*.{html,js,svelte,ts}',
40
38
  ```
41
39
 
42
- Upgrading works as follows:
40
+ ### Update
41
+
42
+ Make sure your project has a script called `upgrade:hk` to upgrade all packages
43
+ in the '@hkdigital' namespace.
43
44
 
44
45
  ```bash
45
- ncu "@hkdigital/*" -u && pnpm install
46
+ pnpm upgrade:hk
46
47
  ```
47
48
 
48
- We use a wildcard to upgrade all installed `node_modules` in the scope `@hkdigital`.
49
-
50
- You can also add this command to your project. To do so, add the lines to the bottom of the `scripts` section of your `package.json`.
49
+ ### The package.json scripts:
51
50
 
52
51
  ```bash
53
- "upgrade:hk": "ncu --dep dev,optional,peer,prod '@hkdigital/*' -u && pnpm install",
54
- "upgrade:all": "ncu -u && pnpm install"
52
+ pnpm add -D npm-check-updates
53
+ pnpm add -D npm-check-updates
55
54
  ```
56
55
 
57
- ### Import JS & Svelte
56
+ ```js
57
+ "scripts": {
58
+ "upgrade:hk": "run-s upgrade:hk:update pnpm:install",
59
+ "upgrade:hk:update": "ncu --dep dev,optional,peer,prod '@hkdigital/*' -u",
60
+ "pnpm:install": "pnpm install"
61
+ }
62
+ ```
58
63
 
59
- All exports are in subfolders.
60
64
 
61
- For example to import a constant from `constants/regexp/index.js`
65
+ ### Import JS, Svelte files and Typedefs
66
+
67
+ Most subfolders have an index.js that export all functionality and typedefs.
62
68
 
63
69
  ```svelte
64
- import { CHAR } from '@hkdigital/lib-sveltekit/constants/regexp';
70
+ import { CHAR } from '@hkdigital/lib-sveltekit/constants/regexp/index.js';
65
71
  ```
66
72
 
67
73
  ### Import CSS
@@ -130,6 +136,14 @@ npm publish --access public
130
136
  pnpm run publish:npm
131
137
  ```
132
138
 
139
+ ### Troubleshooting
140
+
141
+ #### Running scripts from package.json in Windows
142
+
143
+ The CMD terminal in Windows is quite limited. Use the PowerShell instead of some scripts from package.json do not run correctly.
144
+
145
+
133
146
  ## Contribute
134
147
 
135
- If your wish to contribute to this library, please contact us [HKdigital](https://hkdigital.nl/contact). Alternatively, the license permits you to fork the library and publish under an alternative name. Change the package name in [package.json](./package.json) to do so.
148
+ If your wish to contribute to this library, please contact us [HKdigital](https://hkdigital.nl/contact). Alternatively, the license permits you to fork the library and publish under an alternative name. Don't forget to change the package name in [package.json](./package.json) if you do so.
149
+
@@ -1,5 +1,3 @@
1
- @define-mixin text_block {
2
-
3
1
  /* .on-primary-dark
4
2
  {
5
3
  & [data-title-text-button-block] {
@@ -14,7 +12,6 @@
14
12
  } */
15
13
 
16
14
  [data-title-text-button-block] {
17
-
18
15
  &.block-width {
19
16
  @apply w-1/2;
20
17
  }
@@ -28,14 +25,10 @@
28
25
  @apply text-base-md;
29
26
  }
30
27
 
31
- & > .content-box:has( + .footer-box )
32
- {
28
+ & > .content-box:has(+ .footer-box) {
33
29
  @apply mb-30p; /* 10p + 20p */
34
30
  }
35
31
 
36
32
  & > .footer-box {
37
33
  }
38
34
  }
39
-
40
-
41
- }
@@ -1,6 +1,5 @@
1
1
  @import '../../global/on-colors.css';
2
2
 
3
- @define-mixin boxes-game-box {
4
3
  [data-boxes='game-box'] {
5
4
  /*& .game-box-padding-20p {
6
5
  @apply mt-20p;
@@ -9,4 +8,4 @@
9
8
  @apply ml-20p;
10
9
  }*/
11
10
  }
12
- }
11
+
@@ -1,4 +1,4 @@
1
- @define-mixin component-button {
1
+
2
2
  [data-component='button'] {
3
3
  /* ---- Core Button Variables ---- */
4
4
 
@@ -73,48 +73,48 @@
73
73
  /* Role-based styling for primary buttons */
74
74
  [data-component='button'][data-role='primary'] {
75
75
  @apply border-width-normal;
76
- border-color: rgb(var(--btn-primary-border));
77
- background-color: rgb(var(--btn-primary-bg));
78
- color: rgb(var(--btn-primary-text));
76
+ border-color: var(--btn-primary-border);
77
+ background-color: var(--btn-primary-bg);
78
+ color: var(--btn-primary-text);
79
79
 
80
80
  &:hover:not(:disabled):not(.state-selected) {
81
- border-color: rgb(var(--btn-primary-hover-border));
82
- background-color: rgb(var(--btn-primary-hover-bg));
81
+ border-color: var(--btn-primary-hover-border);
82
+ background-color: var(--btn-primary-hover-bg);
83
83
  }
84
84
 
85
85
  &:focus-visible {
86
- @apply outline outline-normal outline-offset-normal;
87
- outline-color: rgb(var(--btn-primary-focus-outline));
86
+ @apply outline-normal outline-offset-normal;
87
+ outline-color: var(--btn-primary-focus-outline);
88
88
  }
89
89
 
90
90
  &.state-selected {
91
- background-color: rgb(var(--btn-primary-selected-bg));
92
- border-color: rgb(var(--btn-primary-selected-border));
93
- color: rgb(var(--btn-primary-selected-text));
91
+ background-color: var(--btn-primary-selected-bg);
92
+ border-color: var(--btn-primary-selected-border);
93
+ color: var(--btn-primary-selected-text);
94
94
  }
95
95
  }
96
96
 
97
97
  /* Role-based styling for secondary buttons */
98
98
  [data-component='button'][data-role='secondary'] {
99
99
  @apply border-width-normal;
100
- border-color: rgb(var(--btn-secondary-border));
101
- color: rgb(var(--btn-secondary-text));
100
+ border-color: var(--btn-secondary-border);
101
+ color: var(--btn-secondary-text);
102
102
  background-color: var(--btn-secondary-bg);
103
103
 
104
104
  &:hover:not(:disabled):not(.state-selected) {
105
- background-color: rgb(var(--btn-secondary-hover-bg));
106
- border-color: rgb(var(--btn-secondary-hover-border));
105
+ background-color: var(--btn-secondary-hover-bg);
106
+ border-color: var(--btn-secondary-hover-border);
107
107
  }
108
108
 
109
109
  &:focus-visible {
110
110
  @apply outline outline-normal outline-offset-normal;
111
- outline-color: rgb(var(--btn-secondary-focus-outline));
111
+ outline-color: var(--btn-secondary-focus-outline);
112
112
  }
113
113
 
114
114
  &.state-selected {
115
- background-color: rgb(var(--btn-secondary-selected-bg));
116
- border-color: rgb(var(--btn-secondary-selected-border));
117
- color: rgb(var(--btn-secondary-selected-text));
115
+ background-color: var(--btn-secondary-selected-bg);
116
+ border-color: var(--btn-secondary-selected-border);
117
+ color: var(--btn-secondary-selected-text);
118
118
  }
119
119
  }
120
120
 
@@ -128,7 +128,7 @@
128
128
  }
129
129
 
130
130
  &.state-error {
131
- border-color: rgb(var(--btn-error-border));
131
+ border-color:var(--btn-error-border);
132
132
  }
133
133
 
134
134
  &.state-loading {
@@ -143,4 +143,4 @@
143
143
  opacity: var(--btn-disabled-opacity);
144
144
  pointer-events: none;
145
145
  }
146
- }
146
+
@@ -1,6 +1,5 @@
1
1
  @import '../../global/on-colors.css';
2
2
 
3
- @define-mixin buttons-skip-button {
4
3
  [data-button='skip-button'] {
5
4
  }
6
- }
5
+
@@ -1,4 +1,4 @@
1
- @define-mixin component-draggable {
1
+
2
2
  [data-component='draggable'] {
3
3
  user-select: none;
4
4
  transition:
@@ -70,4 +70,4 @@
70
70
  opacity: 1;
71
71
  }
72
72
  }
73
- }
73
+
@@ -1,48 +1,58 @@
1
- @define-mixin component-drop-zone {
2
- /* Visual styling and customizable aspects */
3
- [data-component='drop-zone'] {
4
- /*min-height: 100px;*/
5
- border: 1px dashed rgb(var(--color-surface-400));
6
- border-radius: var(--theme-rounded-container);
7
- /*padding: 1rem;*/
8
- transition: all 0.2s ease;
9
- position: relative;
10
- background-color: rgb(var(--color-surface-50) / 0.5);
1
+ /* Visual styling and customizable aspects */
2
+ [data-component='drop-zone'] {
3
+ /*min-height: 100px;*/
4
+ border: 1px dashed var(--color-surface-400);
5
+ border-radius: var(--theme-rounded-container);
6
+ /*padding: 1rem;*/
7
+ transition: all 0.2s ease;
8
+ position: relative;
9
+ background-color: --alpha(var(--color-surface-50) / 0.5);
11
10
 
12
- /* State-based styling using state classes - visual aspects only */
13
- &.state-ready {
14
- border-color: rgb(var(--color-surface-400));
15
- background-color: transparent;
16
- }
17
-
18
- &.state-drag-over {
19
- border-color: rgb(var(--color-primary-400));
20
- background-color: rgb(var(--color-primary-500) / 0.05);
21
- }
11
+ /* State-based styling using state classes - visual aspects only */
12
+ &.state-ready {
13
+ border-color: var(--color-surface-400);
14
+ background-color: transparent;
15
+ }
22
16
 
23
- &.state-can-drop {
24
- border-color: rgb(var(--color-success-500));
25
- background-color: rgb(var(--color-success-500) / 0.08);
26
- box-shadow: 0 0 0 3px rgb(var(--color-success-500) / 0.2);
27
- }
17
+ &.state-drag-over {
18
+ border-color: var(--color-primary-400);
19
+ background-color: color-mix(
20
+ in oklch,
21
+ var(--color-primary-500) 5%,
22
+ transparent
23
+ );
24
+ }
25
+ &.state-can-drop {
26
+ border-color: var(--color-success-500);
27
+ background-color: color-mix(
28
+ in oklch,
29
+ var(--color-success-500) 8%,
30
+ transparent
31
+ );
32
+ box-shadow: 0 0 0 3px
33
+ color-mix(in oklch, var(--color-success-500) 20%, transparent);
34
+ }
28
35
 
29
- &.state-cannot-drop {
30
- border-color: rgb(var(--color-error-500));
31
- background-color: rgb(var(--color-error-500) / 0.08);
32
- cursor: not-allowed;
33
- }
36
+ &.state-cannot-drop {
37
+ border-color: var(--color-error-500);
38
+ background-color: color-mix(
39
+ in oklch,
40
+ var(--color-error-500) 8%,
41
+ transparent
42
+ );
43
+ cursor: not-allowed;
44
+ }
34
45
 
35
- /*&.state-drop-disabled {
46
+ /*&.state-drop-disabled {
36
47
  opacity: 0.5;
37
48
  cursor: not-allowed;
38
- background-color: rgb(var(--color-surface-100));
49
+ background-color: var(--color-surface-100);
39
50
  }*/
40
- }
51
+ }
41
52
 
42
- /* Default styling for inner elements - all visual/customizable */
43
- [data-layer='content'],
44
- [data-layer='preview'],
45
- [data-layer='empty'] {
46
- @apply type-base-md;
47
- }
53
+ /* Default styling for inner elements - all visual/customizable */
54
+ [data-layer='content'],
55
+ [data-layer='preview'],
56
+ [data-layer='empty'] {
57
+ @apply type-base-md;
48
58
  }
@@ -1,22 +1,16 @@
1
- @define-mixin component-icon-steeze {
1
+ /* @note using CSS vars defined in the parent button postcss */
2
2
 
3
- /* @note using CSS vars defined in the parent button postcss */
4
-
5
- /* Type-based styling for text buttons */
6
- [data-component="icon"][data-type="steeze"] {
7
-
8
- &[data-size="sm"] {
9
- @apply w-16bt h-16bt;
10
- }
11
-
12
- &[data-size="md"] {
13
- @apply w-28bt h-28bt;
14
- }
15
-
16
- &[data-size="lg"] {
17
- @apply w-50bt h-50bt;
18
- }
3
+ /* Type-based styling for text buttons */
4
+ [data-component='icon'][data-type='steeze'] {
5
+ &[data-size='sm'] {
6
+ @apply w-16bt h-16bt;
7
+ }
19
8
 
9
+ &[data-size='md'] {
10
+ @apply w-28bt h-28bt;
20
11
  }
21
12
 
22
- }
13
+ &[data-size='lg'] {
14
+ @apply w-50bt h-50bt;
15
+ }
16
+ }
@@ -1,103 +1,101 @@
1
1
  /*@import "../../global/on-colors.css";*/
2
2
 
3
- @define-mixin inputs-text-input {
4
- [data-input='text-input'] {
5
- /* Base */
3
+ [data-input='text-input'] {
4
+ /* Base */
6
5
 
7
- /* Required and disabled */
6
+ /* Required and disabled */
8
7
 
9
- &.required {
10
- }
11
- &.disabled {
8
+ &.required {
9
+ }
10
+ &.disabled {
11
+ }
12
+
13
+ /* Focus */
14
+
15
+ &.focused {
16
+ border: solid thin black;
17
+
18
+ & [data-child='legend'] {
19
+ color: black;
12
20
  }
13
21
 
14
- /* Focus */
22
+ & [data-child='input'] {
23
+ color: black;
24
+ }
25
+ }
15
26
 
16
- &.focused {
17
- border: solid thin black;
27
+ &.unfocused {
28
+ border: solid thin grey;
18
29
 
19
- & [data-child='legend'] {
20
- color: black;
21
- }
30
+ & [data-child='legend'] {
31
+ color: grey;
32
+ }
22
33
 
23
- & [data-child='input'] {
24
- color: black;
25
- }
34
+ & [data-child='input'] {
35
+ color: grey;
26
36
  }
37
+ }
27
38
 
28
- &.unfocused {
29
- border: solid thin grey;
39
+ /* Invalid */
40
+ &.invalid {
41
+ &.pristine [data-child='legend'] {
42
+ color: white;
43
+ background-color: orange;
44
+ }
30
45
 
31
- & [data-child='legend'] {
32
- color: grey;
46
+ &.dirty {
47
+ &.focused [data-child='legend'] {
48
+ color: black;
49
+ background-color: yellow;
33
50
  }
34
51
 
35
- & [data-child='input'] {
36
- color: grey;
52
+ &.unfocused [data-child='legend'] {
53
+ color: white;
54
+ background-color: red;
37
55
  }
38
56
  }
57
+ }
39
58
 
40
- /* Invalid */
41
- &.invalid {
42
- &.pristine [data-child='legend'] {
43
- color: white;
44
- background-color: orange;
45
- }
59
+ /* Pristine (valid-invalid) */
46
60
 
47
- &.dirty {
48
- &.focused [data-child='legend'] {
49
- color: black;
50
- background-color: yellow;
51
- }
61
+ &.pristine.valid {
62
+ & [data-child='icon-box'] {
63
+ color: grey;
64
+ }
65
+ }
52
66
 
53
- &.unfocused [data-child='legend'] {
54
- color: white;
55
- background-color: red;
56
- }
57
- }
67
+ &.pristine.invalid {
68
+ & [data-child='icon-box'] {
69
+ color: orange;
58
70
  }
71
+ }
59
72
 
60
- /* Pristine (valid-invalid) */
73
+ /* Dirty (valid-invalid) */
61
74
 
62
- &.pristine.valid {
75
+ &.dirty.valid {
76
+ &.focused {
63
77
  & [data-child='icon-box'] {
64
78
  color: grey;
65
79
  }
66
80
  }
67
81
 
68
- &.pristine.invalid {
82
+ &.unfocused {
69
83
  & [data-child='icon-box'] {
70
- color: orange;
84
+ color: green;
71
85
  }
72
86
  }
87
+ }
73
88
 
74
- /* Dirty (valid-invalid) */
75
-
76
- &.dirty.valid {
77
- &.focused {
78
- & [data-child='icon-box'] {
79
- color: grey;
80
- }
81
- }
82
-
83
- &.unfocused {
84
- & [data-child='icon-box'] {
85
- color: green;
86
- }
89
+ &.dirty.invalid {
90
+ &.focused {
91
+ & [data-child='icon-box'] {
92
+ color: orange;
87
93
  }
88
94
  }
89
95
 
90
- &.dirty.invalid {
91
- &.focused {
92
- & [data-child='icon-box'] {
93
- color: orange;
94
- }
95
- }
96
-
97
- &.unfocused {
98
- & [data-child='icon-box'] {
99
- color: red;
100
- }
96
+ &.unfocused {
97
+ & [data-child='icon-box'] {
98
+ color: red;
101
99
  }
102
100
  }
103
101
  }
@@ -1,27 +1,25 @@
1
- @define-mixin component-panel {
2
- [data-component='panel'] {
3
- @apply py-30up px-40up;
4
- @apply rounded-md;
1
+ [data-component='panel'] {
2
+ @apply py-30up px-40up;
3
+ @apply rounded-md;
5
4
 
6
- &[data-variant='light'] {
7
- @apply bg-surface-50;
8
- }
5
+ &[data-variant='light'] {
6
+ @apply bg-surface-50;
7
+ }
9
8
 
10
- &[data-variant='dark'] {
11
- @apply bg-surface-950;
12
- }
9
+ &[data-variant='dark'] {
10
+ @apply bg-surface-950;
11
+ }
13
12
 
14
- /* Size variants */
15
- &[data-width='sm'] {
16
- width: calc(400px * var(--scale-ui));
17
- }
13
+ /* Size variants */
14
+ &[data-width='sm'] {
15
+ width: calc(400px * var(--scale-ui));
16
+ }
18
17
 
19
- &[data-width='md'] {
20
- width: calc(600px * var(--scale-ui));
21
- }
18
+ &[data-width='md'] {
19
+ width: calc(600px * var(--scale-ui));
20
+ }
22
21
 
23
- &[data-width='lg'] {
24
- width: calc(800px * var(--scale-ui));
25
- }
22
+ &[data-width='lg'] {
23
+ width: calc(800px * var(--scale-ui));
26
24
  }
27
25
  }
@@ -1,6 +1,4 @@
1
1
  @import '../../global/on-colors.css';
2
2
 
3
- @define-mixin rows-panel-grid-row {
4
- [data-row='panel-grid-row'] {
5
- }
3
+ [data-row='panel-grid-row'] {
6
4
  }
@@ -1,7 +1,5 @@
1
1
  @import '../../global/on-colors.css';
2
2
 
3
- @define-mixin rows-panel-row-2 {
4
- [data-row='panel-grid-row'][data-wrapper='panel-row-2'] {
5
- @apply gap-20p mb-8p mt-8p;
6
- }
3
+ [data-row='panel-grid-row'][data-wrapper='panel-row-2'] {
4
+ @apply gap-20p mb-8p mt-8p;
7
5
  }
@@ -26,28 +26,4 @@
26
26
  /* ... */
27
27
  @import './components/blocks/text-block.css';
28
28
 
29
- /* Wrap component styles in theme selector */
30
29
 
31
- [data-theme='hkdev'] {
32
- /* Rows */
33
- /* @mixin rows-panel-grid-row;*/
34
- /* @mixin rows-panel-row-2;*/
35
-
36
- /* Buttons */
37
- @mixin component-button;
38
- @mixin component-button-text;
39
- @mixin component-button-icon-steeze;
40
- /* @mixin buttons-skip-button;*/
41
-
42
- @mixin component-draggable;
43
- @mixin component-drop-zone;
44
-
45
- @mixin component-icon-steeze;
46
-
47
- @mixin component-panel;
48
-
49
- @mixin text_block;
50
-
51
- /* Inputs */
52
- @mixin inputs-text-input;
53
- }