@streamscloud/kit 0.45.0 → 0.47.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 (30) hide show
  1. package/dist/ui/cropper/img-cropper/cmp.img-cropper.svelte +2 -7
  2. package/dist/ui/cropper/img-cropper/cmp.img-cropper.svelte.d.ts +1 -7
  3. package/dist/ui/cropper/img-cropper/img-cropper-base-worker.svelte.d.ts +1 -1
  4. package/dist/ui/cropper/img-cropper/img-cropper-base-worker.svelte.js +14 -6
  5. package/dist/ui/cropper/img-cropper/img-cropper-contain-worker.svelte.js +17 -5
  6. package/dist/ui/cropper/img-cropper/img-cropper-cover-worker.svelte.js +24 -5
  7. package/dist/ui/cropper/img-cropper/img-cropper-utils.d.ts +12 -0
  8. package/dist/ui/cropper/img-cropper/img-cropper-utils.js +55 -14
  9. package/dist/ui/cropper/img-cropper/img-cropper-worker.svelte.d.ts +1 -1
  10. package/dist/ui/document-tabs/cmp.document-tabs.svelte +245 -0
  11. package/dist/ui/document-tabs/cmp.document-tabs.svelte.d.ts +80 -0
  12. package/dist/ui/document-tabs/document-tab.svelte +210 -0
  13. package/dist/ui/document-tabs/document-tab.svelte.d.ts +34 -0
  14. package/dist/ui/document-tabs/document-tabs-localization.d.ts +6 -0
  15. package/dist/ui/document-tabs/document-tabs-localization.js +33 -0
  16. package/dist/ui/document-tabs/index.d.ts +3 -0
  17. package/dist/ui/document-tabs/index.js +2 -0
  18. package/dist/ui/document-tabs/types.d.ts +20 -0
  19. package/dist/ui/document-tabs/types.js +1 -0
  20. package/dist/ui/page-layout/cmp.page-panel-sidebars.svelte +29 -3
  21. package/dist/ui/page-layout/cmp.page-panel-sidebars.svelte.d.ts +8 -0
  22. package/dist/ui/page-layout/cmp.page-panel.svelte +66 -42
  23. package/dist/ui/tabs/cmp.tabs.svelte +6 -14
  24. package/dist/ui/tabs/cmp.tabs.svelte.d.ts +5 -11
  25. package/dist/ui/tabs/tab.svelte +14 -75
  26. package/dist/ui/tabs/tab.svelte.d.ts +0 -1
  27. package/dist/ui/tabs/types.d.ts +1 -1
  28. package/package.json +5 -1
  29. package/dist/ui/tabs/tabs-localization.d.ts +0 -3
  30. package/dist/ui/tabs/tabs-localization.js +0 -12
@@ -5,22 +5,21 @@ const isActive = (tab) => (compare ? compare(value, tab.value) : value === tab.v
5
5
 
6
6
  <div class="tabs tabs--{variant}" role="tablist">
7
7
  {#each tabs as tab, i (i)}
8
- <TabItem tab={tab} variant={variant} size={size} active={isActive(tab)} on={{ select: on?.change, close: on?.close }} />
8
+ <TabItem tab={tab} variant={variant} size={size} active={isActive(tab)} on={{ select: on?.change }} />
9
9
  {/each}
10
10
  </div>
11
11
 
12
12
  <!--
13
13
  @component
14
14
  Tabs — header strip for switching between content panels. Panel rendering is consumer-controlled
15
- (switch on the active `value`). Three visual variants:
15
+ (switch on the active `value`). Two visual variants:
16
16
 
17
17
  - **`default`**: underline — a 2px accent bar travels under the active tab; the strip has a bottom border.
18
18
  - **`pills`**: filled — the active tab lifts as a card on an inset tray.
19
- - **`document`**: browser-style tabs — flush, rounded-top; the active tab background matches the canvas so it reads as continuous with the content below.
20
19
 
21
- Providing `on.close` renders a close affordance on each non-disabled tab (works in any variant).
22
- Each tab carries an optional `disabled` flag (non-interactive). For navigation, not single-choice
23
- form input use `SegmentedControl` for the latter (it's a `radiogroup`; this is a `tablist`).
20
+ Each tab carries an optional `disabled` flag (non-interactive). It's a `tablist` for navigation
21
+ between panels, not single-choice form input. Closable tabs are an editor concern, not a panel
22
+ switcher's, so they are not part of this component.
24
23
 
25
24
  ### CSS Custom Properties
26
25
  | Property | Description | Default |
@@ -32,16 +31,13 @@ form input — use `SegmentedControl` for the latter (it's a `radiogroup`; this
32
31
  | `--sc-kit--tabs--radius` | Tab radius (pills) / tray radius | `--sc-kit--radius--sm` / `--sc-kit--radius--md` |
33
32
  | `--sc-kit--tabs--color` | Default tab text color | `--sc-kit--color--text--secondary` |
34
33
  | `--sc-kit--tabs--color--hover` | Hover text color | `--sc-kit--color--text--primary` |
35
- | `--sc-kit--tabs--color--active` | Active tab text color | default: `--sc-kit--color--accent`, pills/document: `--sc-kit--color--text--primary` |
34
+ | `--sc-kit--tabs--color--active` | Active tab text color | default: `--sc-kit--color--accent`, pills: `--sc-kit--color--text--primary` |
36
35
  | `--sc-kit--tabs--color--disabled` | Disabled tab text color | `--sc-kit--color--text--muted` |
37
36
  | `--sc-kit--tabs--accent` | Underline bar color (default variant) | `--sc-kit--color--accent` |
38
37
  | `--sc-kit--tabs--border-color` | Bottom border color (default variant) | `--sc-kit--color--border` |
39
38
  | `--sc-kit--tabs--pills--background` | Inset tray background (pills variant) | `--sc-kit--color--bg--active` |
40
39
  | `--sc-kit--tabs--pills--background--active` | Active tab background (pills variant) | `--sc-kit--color--bg--panel` |
41
40
  | `--sc-kit--tabs--pills--shadow--active` | Active tab lift shadow (pills variant) | `--sc-kit--shadow--sm` |
42
- | `--sc-kit--tabs--document--background` | Inactive tab background (document variant) | `neutral-200` / `dark-500` |
43
- | `--sc-kit--tabs--document--background--active` | Active tab background (document variant) — matches the canvas | `--sc-kit--color--bg--app` |
44
- | `--sc-kit--tabs--document--background--hover` | Inactive tab hover background (document variant) | `--sc-kit--color--bg--hover` |
45
41
  -->
46
42
 
47
43
  <style>.tabs {
@@ -60,8 +56,4 @@ form input — use `SegmentedControl` for the latter (it's a `radiogroup`; this
60
56
  padding: 0.25rem;
61
57
  background: var(--_tabs--pills-background);
62
58
  border-radius: var(--sc-kit--radius--md);
63
- }
64
- .tabs--document {
65
- gap: 0;
66
- align-items: flex-end;
67
59
  }</style>
@@ -12,8 +12,6 @@ declare function $$render<T>(): {
12
12
  compare?: (a: T, b: T) => boolean;
13
13
  on?: {
14
14
  change?: (value: T) => void;
15
- /** Providing this renders a close affordance on each non-disabled tab (works in any variant). */
16
- close?: (value: T) => void;
17
15
  };
18
16
  };
19
17
  exports: {};
@@ -37,15 +35,14 @@ interface $$IsomorphicComponent {
37
35
  }
38
36
  /**
39
37
  * Tabs — header strip for switching between content panels. Panel rendering is consumer-controlled
40
- * (switch on the active `value`). Three visual variants:
38
+ * (switch on the active `value`). Two visual variants:
41
39
  *
42
40
  * - **`default`**: underline — a 2px accent bar travels under the active tab; the strip has a bottom border.
43
41
  * - **`pills`**: filled — the active tab lifts as a card on an inset tray.
44
- * - **`document`**: browser-style tabs — flush, rounded-top; the active tab background matches the canvas so it reads as continuous with the content below.
45
42
  *
46
- * Providing `on.close` renders a close affordance on each non-disabled tab (works in any variant).
47
- * Each tab carries an optional `disabled` flag (non-interactive). For navigation, not single-choice
48
- * form input use `SegmentedControl` for the latter (it's a `radiogroup`; this is a `tablist`).
43
+ * Each tab carries an optional `disabled` flag (non-interactive). It's a `tablist` for navigation
44
+ * between panels, not single-choice form input. Closable tabs are an editor concern, not a panel
45
+ * switcher's, so they are not part of this component.
49
46
  *
50
47
  * ### CSS Custom Properties
51
48
  * | Property | Description | Default |
@@ -57,16 +54,13 @@ interface $$IsomorphicComponent {
57
54
  * | `--sc-kit--tabs--radius` | Tab radius (pills) / tray radius | `--sc-kit--radius--sm` / `--sc-kit--radius--md` |
58
55
  * | `--sc-kit--tabs--color` | Default tab text color | `--sc-kit--color--text--secondary` |
59
56
  * | `--sc-kit--tabs--color--hover` | Hover text color | `--sc-kit--color--text--primary` |
60
- * | `--sc-kit--tabs--color--active` | Active tab text color | default: `--sc-kit--color--accent`, pills/document: `--sc-kit--color--text--primary` |
57
+ * | `--sc-kit--tabs--color--active` | Active tab text color | default: `--sc-kit--color--accent`, pills: `--sc-kit--color--text--primary` |
61
58
  * | `--sc-kit--tabs--color--disabled` | Disabled tab text color | `--sc-kit--color--text--muted` |
62
59
  * | `--sc-kit--tabs--accent` | Underline bar color (default variant) | `--sc-kit--color--accent` |
63
60
  * | `--sc-kit--tabs--border-color` | Bottom border color (default variant) | `--sc-kit--color--border` |
64
61
  * | `--sc-kit--tabs--pills--background` | Inset tray background (pills variant) | `--sc-kit--color--bg--active` |
65
62
  * | `--sc-kit--tabs--pills--background--active` | Active tab background (pills variant) | `--sc-kit--color--bg--panel` |
66
63
  * | `--sc-kit--tabs--pills--shadow--active` | Active tab lift shadow (pills variant) | `--sc-kit--shadow--sm` |
67
- * | `--sc-kit--tabs--document--background` | Inactive tab background (document variant) | `neutral-200` / `dark-500` |
68
- * | `--sc-kit--tabs--document--background--active` | Active tab background (document variant) — matches the canvas | `--sc-kit--color--bg--app` |
69
- * | `--sc-kit--tabs--document--background--hover` | Inactive tab hover background (document variant) | `--sc-kit--color--bg--hover` |
70
64
  */
71
65
  declare const Cmp: $$IsomorphicComponent;
72
66
  type Cmp<T> = InstanceType<typeof Cmp<T>>;
@@ -1,26 +1,11 @@
1
- <script lang="ts" generics="T">import { IconSlot } from '../icon';
2
- import { TabsLocalization } from './tabs-localization';
3
- import IconDismiss from '@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw';
4
- const { tab, variant, size, active, on } = $props();
5
- const localization = new TabsLocalization();
6
- const closable = $derived(!!on?.close && !tab.disabled);
1
+ <script lang="ts" generics="T">const { tab, variant, size, active, on } = $props();
7
2
  const handleClick = () => {
8
3
  if (tab.disabled || active) {
9
4
  return;
10
5
  }
11
6
  on?.select?.(tab.value);
12
7
  };
13
- const handleClose = (event) => {
14
- event.stopPropagation();
15
- on?.close?.(tab.value);
16
- };
17
- const handleCloseKeydown = (event) => {
18
- if (event.key === 'Enter' || event.key === ' ') {
19
- event.preventDefault();
20
- event.stopPropagation();
21
- on?.close?.(tab.value);
22
- }
23
- };
8
+ export {};
24
9
  </script>
25
10
 
26
11
  <button
@@ -30,25 +15,18 @@ const handleCloseKeydown = (event) => {
30
15
  class:tab--hoverable={!active && !tab.disabled}
31
16
  class:tab--default-active={variant === 'default' && active}
32
17
  class:tab--pills-active={variant === 'pills' && active}
33
- class:tab--document-active={variant === 'document' && active}
34
- class:tab--document-hoverable={variant === 'document' && !active && !tab.disabled}
35
18
  role="tab"
36
19
  aria-selected={active}
37
20
  disabled={tab.disabled}
38
21
  onclick={handleClick}>
39
22
  <span class="tab__label">{tab.label}</span>
40
- {#if closable}
41
- <span class="tab__close" role="button" tabindex="0" aria-label={localization.close} onclick={handleClose} onkeydown={handleCloseKeydown}>
42
- <IconSlot icon={IconDismiss} fallbacks={{ size: 'sm' }} />
43
- </span>
44
- {/if}
45
23
  </button>
46
24
 
47
25
  <style>.tab {
48
- --_tab--height: var(--sc-kit--tabs--height, 2.25rem);
49
- --_tab--font-size: var(--sc-kit--tabs--font-size, var(--sc-kit--font-size--md));
50
- --_tab--font-weight: var(--sc-kit--tabs--font-weight, var(--sc-kit--font-weight--medium));
51
- --_tab--padding-inline: var(--sc-kit--tabs--padding-inline, 0.875rem);
26
+ --_tab--height: var(--sc-kit--tabs--height, var(--_tab--size-height));
27
+ --_tab--font-size: var(--sc-kit--tabs--font-size, var(--_tab--size-font-size));
28
+ --_tab--font-weight: var(--sc-kit--tabs--font-weight, var(--_tab--size-font-weight));
29
+ --_tab--padding-inline: var(--sc-kit--tabs--padding-inline, var(--_tab--size-padding-inline));
52
30
  --_tab--radius: var(--sc-kit--tabs--radius, var(--sc-kit--radius--sm));
53
31
  --_tab--color: var(--sc-kit--tabs--color, var(--sc-kit--color--text--secondary));
54
32
  --_tab--color-hover: var(--sc-kit--tabs--color--hover, var(--sc-kit--color--text--primary));
@@ -57,9 +35,6 @@ const handleCloseKeydown = (event) => {
57
35
  --_tab--accent: var(--sc-kit--tabs--accent, var(--sc-kit--color--accent));
58
36
  --_tab--pills-background-active: var(--sc-kit--tabs--pills--background--active, var(--sc-kit--color--bg--panel));
59
37
  --_tab--pills-shadow-active: var(--sc-kit--tabs--pills--shadow--active, var(--sc-kit--shadow--sm));
60
- --_tab--document-background: var(--sc-kit--tabs--document--background, light-dark(#e5e7eb, #272727));
61
- --_tab--document-background-active: var(--sc-kit--tabs--document--background--active, var(--sc-kit--color--bg--app));
62
- --_tab--document-background-hover: var(--sc-kit--tabs--document--background--hover, var(--sc-kit--color--bg--hover));
63
38
  position: relative;
64
39
  display: inline-flex;
65
40
  align-items: center;
@@ -80,16 +55,16 @@ const handleCloseKeydown = (event) => {
80
55
  transition: color var(--sc-kit--duration--base) var(--sc-kit--ease--default), background-color var(--sc-kit--duration--base) var(--sc-kit--ease--default);
81
56
  }
82
57
  .tab--sm {
83
- --sc-kit--tabs--height: 1.75rem;
84
- --sc-kit--tabs--font-size: var(--sc-kit--font-size--sm);
85
- --sc-kit--tabs--font-weight: var(--sc-kit--font-weight--regular);
86
- --sc-kit--tabs--padding-inline: 0.625rem;
58
+ --_tab--size-height: 1.75rem;
59
+ --_tab--size-font-size: var(--sc-kit--font-size--sm);
60
+ --_tab--size-font-weight: var(--sc-kit--font-weight--regular);
61
+ --_tab--size-padding-inline: 0.625rem;
87
62
  }
88
63
  .tab--md {
89
- --sc-kit--tabs--height: 2.25rem;
90
- --sc-kit--tabs--font-size: var(--sc-kit--font-size--md);
91
- --sc-kit--tabs--font-weight: var(--sc-kit--font-weight--medium);
92
- --sc-kit--tabs--padding-inline: 0.875rem;
64
+ --_tab--size-height: 2.25rem;
65
+ --_tab--size-font-size: var(--sc-kit--font-size--md);
66
+ --_tab--size-font-weight: var(--sc-kit--font-weight--medium);
67
+ --_tab--size-padding-inline: 0.875rem;
93
68
  }
94
69
  .tab--hoverable:hover {
95
70
  color: var(--_tab--color-hover);
@@ -123,23 +98,6 @@ const handleCloseKeydown = (event) => {
123
98
  background: var(--_tab--pills-background-active);
124
99
  box-shadow: var(--_tab--pills-shadow-active);
125
100
  }
126
- .tab--document {
127
- --_tab--color-active-default: var(--sc-kit--color--text--primary);
128
- --_tab--height: 2rem;
129
- --_tab--padding-inline: 0.75rem;
130
- justify-content: flex-start;
131
- gap: 0.5rem;
132
- min-width: 7rem;
133
- background: var(--_tab--document-background);
134
- border-radius: 0.25rem 0.5rem 0 0;
135
- }
136
- .tab--document-hoverable:hover {
137
- background: var(--_tab--document-background-hover);
138
- }
139
- .tab--document-active {
140
- color: var(--_tab--color-active);
141
- background: var(--_tab--document-background-active);
142
- }
143
101
  .tab:focus-visible {
144
102
  outline: 2px solid var(--sc-kit--color--border--focus);
145
103
  outline-offset: 2px;
@@ -147,23 +105,4 @@ const handleCloseKeydown = (event) => {
147
105
  .tab__label {
148
106
  display: inline-block;
149
107
  max-width: 100%;
150
- }
151
- .tab__close {
152
- display: inline-flex;
153
- align-items: center;
154
- justify-content: center;
155
- flex-shrink: 0;
156
- margin-left: auto;
157
- padding: 0.125rem;
158
- color: var(--sc-kit--color--text--secondary);
159
- border-radius: var(--sc-kit--radius--sm);
160
- cursor: pointer;
161
- transition: color var(--sc-kit--duration--base) var(--sc-kit--ease--default), background-color var(--sc-kit--duration--base) var(--sc-kit--ease--default);
162
- }
163
- .tab__close:hover {
164
- color: var(--sc-kit--color--text--primary);
165
- }
166
- .tab__close:focus-visible {
167
- outline: 2px solid var(--sc-kit--color--border--focus);
168
- outline-offset: 2px;
169
108
  }</style>
@@ -7,7 +7,6 @@ declare function $$render<T>(): {
7
7
  active: boolean;
8
8
  on?: {
9
9
  select?: (value: T) => void;
10
- close?: (value: T) => void;
11
10
  };
12
11
  };
13
12
  exports: {};
@@ -1,4 +1,4 @@
1
- export type TabsVariant = 'default' | 'pills' | 'document';
1
+ export type TabsVariant = 'default' | 'pills';
2
2
  export type TabsSize = 'sm' | 'md';
3
3
  export type Tab<TValue = unknown> = {
4
4
  value: TValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.45.0",
3
+ "version": "0.47.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",
@@ -163,6 +163,10 @@
163
163
  "types": "./dist/ui/divider/index.d.ts",
164
164
  "svelte": "./dist/ui/divider/index.js"
165
165
  },
166
+ "./ui/document-tabs": {
167
+ "types": "./dist/ui/document-tabs/index.d.ts",
168
+ "svelte": "./dist/ui/document-tabs/index.js"
169
+ },
166
170
  "./ui/drag-and-drop": {
167
171
  "types": "./dist/ui/drag-and-drop/index.d.ts",
168
172
  "svelte": "./dist/ui/drag-and-drop/index.js"
@@ -1,3 +0,0 @@
1
- export declare class TabsLocalization {
2
- get close(): string;
3
- }
@@ -1,12 +0,0 @@
1
- import { AppLocale } from '../../core/locale';
2
- const loc = {
3
- close: {
4
- en: 'Close tab',
5
- no: 'Lukk fane'
6
- }
7
- };
8
- export class TabsLocalization {
9
- get close() {
10
- return loc.close[AppLocale.current];
11
- }
12
- }