negodesign 0.0.6 → 0.0.7

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.
Binary file
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { ModeWatcher } from "mode-watcher";
4
+ import { defineNegodesignConfig } from "../config";
5
+ import type { NegodesignConfig } from "../config";
6
+
7
+ let {
8
+ translations,
9
+ children,
10
+ }: {
11
+ translations?: NegodesignConfig["translations"];
12
+ children: any;
13
+ } = $props();
14
+
15
+ $effect(() => {
16
+ if (translations) {
17
+ defineNegodesignConfig({ translations });
18
+ }
19
+ });
20
+ </script>
21
+
22
+ <ModeWatcher />
23
+ {@render children()}
@@ -0,0 +1,8 @@
1
+ import type { NegodesignConfig } from "../config";
2
+ type $$ComponentProps = {
3
+ translations?: NegodesignConfig["translations"];
4
+ children: any;
5
+ };
6
+ declare const NegoDesignLayout: import("svelte").Component<$$ComponentProps, {}, "">;
7
+ type NegoDesignLayout = ReturnType<typeof NegoDesignLayout>;
8
+ export default NegoDesignLayout;
@@ -4,6 +4,8 @@
4
4
  import type { CarouselProps } from "../../../../core/carousel/data/CarouselModel";
5
5
  import type { Snippet } from "svelte";
6
6
  import Button from "../../../../ui/button/button.svelte";
7
+ import { t } from "../../../../../i18n";
8
+ import Logo from "../../../../../assets/login-01-admin.webp";
7
9
 
8
10
  type Props = {
9
11
  title?: string | Snippet;
@@ -45,7 +47,7 @@
45
47
  {#if typeof title === "function"}
46
48
  {@render title()}
47
49
  {:else}
48
- {title || ""}
50
+ {title || $t("label.welcome")}
49
51
  {/if}
50
52
  </div>
51
53
  </div>
@@ -100,6 +102,12 @@
100
102
  {/each}
101
103
  </div>
102
104
  </section>
105
+
106
+ <aside
107
+ class="hidden z-50 lg:block lg:absolute lg:right-0 lg:-bottom-3 lg:w-105 lg:h-105"
108
+ >
109
+ <img src={Logo} alt="" class="shadow rounded-tl-lg rounded-bl-lg" />
110
+ </aside>
103
111
  </div>
104
112
 
105
113
  <aside class="absolute grid-pattern p-0 top-0 h-screen w-8/12"></aside>
@@ -24,6 +24,13 @@
24
24
  </script>
25
25
 
26
26
  <main class="h-screen w-screen flex items-center">
27
+ <svg width="0" height="0" class="absolute">
28
+ <defs>
29
+ <clipPath id="grid-curve-clip" clipPathUnits="objectBoundingBox">
30
+ <path d="M0.35,0 L1,0 C0.85,0.3 1,0.6 0.4,1 L1,1 Z" />
31
+ </clipPath>
32
+ </defs>
33
+ </svg>
27
34
  <div class="hidden md:block md:w-8/12">
28
35
  <LeftHero {title} varient={varient ?? "POINTER"} items={carousel ?? []} />
29
36
  </div>
@@ -45,5 +52,6 @@
45
52
  transparent 1px
46
53
  ),
47
54
  linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
55
+ clip-path: url(#grid-curve-clip);
48
56
  }
49
57
  </style>
@@ -38,7 +38,7 @@
38
38
  </DropdownMenu.Trigger>
39
39
  <DropdownMenu.Content {align}>
40
40
  <DropdownMenu.RadioGroup bind:value={$locale}>
41
- {#each locales as code (code)}
41
+ {#each $locales as code (code)}
42
42
  <DropdownMenu.RadioItem value={code}>
43
43
  {$t(`language.${code}`)}
44
44
  </DropdownMenu.RadioItem>
@@ -0,0 +1,7 @@
1
+ type Translations = Record<string, Record<string, string>>;
2
+ export interface NegodesignConfig {
3
+ translations?: Translations;
4
+ }
5
+ export declare function defineNegodesignConfig(userConfig: NegodesignConfig): NegodesignConfig;
6
+ export declare function getConfig(): NegodesignConfig;
7
+ export {};
package/dist/config.js ADDED
@@ -0,0 +1,8 @@
1
+ let config = {};
2
+ export function defineNegodesignConfig(userConfig) {
3
+ config = userConfig;
4
+ return config;
5
+ }
6
+ export function getConfig() {
7
+ return config;
8
+ }
package/dist/globals.css CHANGED
@@ -788,9 +788,15 @@
788
788
  .rounded-tl-\[35px\] {
789
789
  border-top-left-radius: 35px;
790
790
  }
791
+ .rounded-tl-lg {
792
+ border-top-left-radius: var(--radius);
793
+ }
791
794
  .rounded-tr-\[35px\] {
792
795
  border-top-right-radius: 35px;
793
796
  }
797
+ .rounded-bl-lg {
798
+ border-bottom-left-radius: var(--radius);
799
+ }
794
800
  .border {
795
801
  border-style: var(--tw-border-style);
796
802
  border-width: 1px;
@@ -1198,6 +1204,10 @@
1198
1204
  .bg-blend-color {
1199
1205
  background-blend-mode: color;
1200
1206
  }
1207
+ .shadow {
1208
+ --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1209
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1210
+ }
1201
1211
  .shadow-2xl {
1202
1212
  --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));
1203
1213
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -2305,6 +2315,26 @@
2305
2315
  display: none;
2306
2316
  }
2307
2317
  }
2318
+ @media (width >= 64rem) {
2319
+ .lg\:absolute {
2320
+ position: absolute;
2321
+ }
2322
+ .lg\:right-0 {
2323
+ right: 0px;
2324
+ }
2325
+ .lg\:-bottom-3 {
2326
+ bottom: calc(var(--spacing) * -3);
2327
+ }
2328
+ .lg\:block {
2329
+ display: block;
2330
+ }
2331
+ .lg\:h-105 {
2332
+ height: calc(var(--spacing) * 105);
2333
+ }
2334
+ .lg\:w-105 {
2335
+ width: calc(var(--spacing) * 105);
2336
+ }
2337
+ }
2308
2338
  .dark\:scale-0:is(.dark *) {
2309
2339
  --tw-scale-x: 0%;
2310
2340
  --tw-scale-y: 0%;
@@ -2648,9 +2678,6 @@
2648
2678
  width: calc(var(--spacing) * 4);
2649
2679
  height: calc(var(--spacing) * 4);
2650
2680
  }
2651
- .\[\&_svg\:not\(\[data-loading-icon\]\)\]\:hidden svg:not([data-loading-icon]) {
2652
- display: none;
2653
- }
2654
2681
  .\[\&_text\]\:stroke-transparent text {
2655
2682
  stroke: transparent;
2656
2683
  }
@@ -0,0 +1,4 @@
1
+ type Translations = Record<string, Record<string, string>>;
2
+ export declare function getMergedTranslations(): Translations;
3
+ export declare function getLocales(): string[];
4
+ export {};
@@ -0,0 +1,26 @@
1
+ import baseTranslations from "./translations";
2
+ import { getConfig } from "../config";
3
+ function deepMerge(target, source) {
4
+ const result = { ...target };
5
+ for (const key of Object.keys(source)) {
6
+ if (source[key] &&
7
+ typeof source[key] === "object" &&
8
+ !Array.isArray(source[key]) &&
9
+ target[key] &&
10
+ typeof target[key] === "object") {
11
+ result[key] = deepMerge(target[key], source[key]);
12
+ }
13
+ else {
14
+ result[key] = source[key];
15
+ }
16
+ }
17
+ return result;
18
+ }
19
+ export function getMergedTranslations() {
20
+ const userConfig = getConfig();
21
+ const merged = deepMerge(baseTranslations, userConfig.translations ?? {});
22
+ return merged;
23
+ }
24
+ export function getLocales() {
25
+ return Object.keys(getMergedTranslations());
26
+ }
@@ -1,6 +1,5 @@
1
- import translations from "./translations";
2
1
  export declare const locale: import("svelte/store").Writable<string>;
3
- export declare const locales: Array<keyof typeof translations>;
4
2
  type TranslationVars = Record<string, string | number>;
3
+ export declare const locales: import("svelte/store").Readable<string[]>;
5
4
  export declare const t: import("svelte/store").Readable<(key: string, vars?: TranslationVars) => string>;
6
5
  export {};
@@ -1,24 +1,23 @@
1
1
  import { derived, writable } from "svelte/store";
2
- import translations from "./translations";
2
+ import { getMergedTranslations } from "./config";
3
3
  export const locale = writable("en");
4
- export const locales = Object.keys(translations);
5
4
  function translate(currentLocale, key, vars) {
6
5
  if (!key)
7
6
  throw new Error("no key provided to $t()");
8
7
  if (!currentLocale)
9
8
  throw new Error(`no translation for key "${key}"`);
10
- // Fazemos o type assertion para garantir que o TypeScript reconheça as chaves com segurança
9
+ const translations = getMergedTranslations();
11
10
  const langTranslations = translations[currentLocale];
12
11
  if (!langTranslations)
13
12
  throw new Error(`no translation found for locale "${currentLocale}"`);
14
13
  let text = langTranslations[key];
15
14
  if (!text)
16
15
  throw new Error(`no translation found for ${currentLocale}.${key}`);
17
- // Substitui as variáveis passadas na string de tradução de forma segura
18
16
  Object.keys(vars).forEach((k) => {
19
17
  const regex = new RegExp(`{{${k}}}`, "g");
20
18
  text = text.replace(regex, String(vars[k]));
21
19
  });
22
20
  return text;
23
21
  }
22
+ export const locales = derived(locale, () => Object.keys(getMergedTranslations()));
24
23
  export const t = derived(locale, ($locale) => (key, vars = {}) => translate($locale, key, vars));
@@ -31,6 +31,7 @@ declare const _default: {
31
31
  "label.users": string;
32
32
  "label.account": string;
33
33
  "label.profile": string;
34
+ "label.welcome": string;
34
35
  "text.login": string;
35
36
  "text.register": string;
36
37
  "language.en": string;
@@ -68,6 +69,7 @@ declare const _default: {
68
69
  "label.users": string;
69
70
  "label.account": string;
70
71
  "label.profile": string;
72
+ "label.welcome": string;
71
73
  "text.login": string;
72
74
  "text.register": string;
73
75
  "language.en": string;
@@ -31,6 +31,7 @@ export default {
31
31
  "label.users": "Users",
32
32
  "label.account": "Account",
33
33
  "label.profile": "Profile",
34
+ "label.welcome": "Welcome",
34
35
  "text.login": "Enter your credentials below to securely access your account and continue where you left off.",
35
36
  "text.register": "Fill in the fields below with your information to create your new account and enjoy all our features.",
36
37
  "language.en": "English",
@@ -68,6 +69,7 @@ export default {
68
69
  "label.users": "Utilizadores",
69
70
  "label.account": "Conta",
70
71
  "label.profile": "Perfil",
72
+ "label.welcome": "Bem vindo",
71
73
  "text.login": "Insira as suas credenciais abaixo para aceder à sua conta com segurança e continuar de onde parou.",
72
74
  "text.register": "Preencha os campos abaixo com as suas informações para criar a sua nova conta e aproveitar todos os nossos recursos.",
73
75
  "language.en": "Inglês",
package/dist/index.d.ts CHANGED
@@ -8,7 +8,10 @@ import MenuBarSidebar from "./components/core/sidebar/MenuBarSidebar.svelte";
8
8
  import AdminContent from "./components/pages/admin/ui/AdminContent.svelte";
9
9
  import AdminPanel from "./components/pages/admin/ui/AdminPanel.svelte";
10
10
  import PageLogin from "./components/pages/login/PageLogin.svelte";
11
- import NegoDesignLayout from "./components/pages/NegoDesignLayout.svelte";
11
+ import NegoDesignLayout from "./components/NegoDesignLayout.svelte";
12
+ export { locale, locales, t } from "./i18n";
13
+ export { defineNegodesignConfig, getConfig } from "./config";
14
+ export { getMergedTranslations, getLocales } from "./i18n/config";
12
15
  export {
13
16
  /** Página de configurações para uma aplicação da negodesign. @see NegoDesignLayout */
14
17
  NegoDesignLayout,
package/dist/index.js CHANGED
@@ -8,7 +8,10 @@ import MenuBarSidebar from "./components/core/sidebar/MenuBarSidebar.svelte";
8
8
  import AdminContent from "./components/pages/admin/ui/AdminContent.svelte";
9
9
  import AdminPanel from "./components/pages/admin/ui/AdminPanel.svelte";
10
10
  import PageLogin from "./components/pages/login/PageLogin.svelte";
11
- import NegoDesignLayout from "./components/pages/NegoDesignLayout.svelte";
11
+ import NegoDesignLayout from "./components/NegoDesignLayout.svelte";
12
+ export { locale, locales, t } from "./i18n";
13
+ export { defineNegodesignConfig, getConfig } from "./config";
14
+ export { getMergedTranslations, getLocales } from "./i18n/config";
12
15
  export {
13
16
  /** Página de configurações para uma aplicação da negodesign. @see NegoDesignLayout */
14
17
  NegoDesignLayout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "negodesign",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -15,6 +15,11 @@
15
15
  "svelte": "./dist/index.js",
16
16
  "default": "./dist/index.js"
17
17
  },
18
+ "./i18n": {
19
+ "types": "./dist/i18n/index.d.ts",
20
+ "svelte": "./dist/i18n/index.js",
21
+ "default": "./dist/i18n/index.js"
22
+ },
18
23
  "./styles.css": "./dist/globals.css",
19
24
  "./*.svelte": "./dist/*.svelte",
20
25
  "./*": {
@@ -1,83 +0,0 @@
1
- <script lang="ts" module>
2
- import type { MouseEventHandler } from 'svelte/elements';
3
-
4
- export type ButtonProps = ButtonPrimitiveProps & {
5
- loading?: boolean;
6
- onClickPromise?: (
7
- e:
8
- | Parameters<MouseEventHandler<HTMLButtonElement>>[0]
9
- | Parameters<MouseEventHandler<HTMLAnchorElement>>[0]
10
- ) => Promise<void>;
11
- };
12
-
13
- export type Size = 'default' | 'xs' | 'sm' | 'lg';
14
-
15
- /**
16
- * Map sizes to their icon/normal size variant
17
- */
18
- export const sizeMap = {
19
- default: {
20
- icon: 'icon',
21
- normal: 'default'
22
- },
23
- xs: {
24
- icon: 'icon-xs',
25
- normal: 'xs'
26
- },
27
- sm: {
28
- icon: 'icon-sm',
29
- normal: 'sm'
30
- },
31
- lg: {
32
- icon: 'icon-lg',
33
- normal: 'lg'
34
- }
35
- } as const;
36
-
37
- export { type ButtonSize, type ButtonVariant } from './ui/button';
38
- </script>
39
-
40
- <script lang="ts">
41
- import { Button, type ButtonProps as ButtonPrimitiveProps } from './ui/button';
42
- import { Spinner } from './ui/spinner';
43
- import { cn } from '../utils.js';
44
-
45
- let {
46
- ref = $bindable(null),
47
- loading: loadingProp = false,
48
- onClickPromise,
49
- onclick,
50
- disabled,
51
- class: className,
52
- children,
53
- ...restProps
54
- }: ButtonProps = $props();
55
-
56
- let pending = $state(false);
57
-
58
- const loading = $derived(loadingProp || pending);
59
- </script>
60
-
61
- <Button
62
- bind:ref
63
- class={cn(loading && '[&_svg:not([data-loading-icon])]:hidden', className)}
64
- disabled={loading || disabled}
65
- onclick={async (e) => {
66
- onclick?.(e as never);
67
-
68
- if (onClickPromise) {
69
- pending = true;
70
- try {
71
- await onClickPromise(e);
72
- } finally {
73
- pending = false;
74
- }
75
- }
76
- }}
77
- {...restProps}
78
- >
79
- {#if loading}
80
- <Spinner data-icon="inline-start" data-loading-icon />
81
- {/if}
82
- {@render children?.()}
83
- </Button>
@@ -1,32 +0,0 @@
1
- import type { MouseEventHandler } from 'svelte/elements';
2
- export type ButtonProps = ButtonPrimitiveProps & {
3
- loading?: boolean;
4
- onClickPromise?: (e: Parameters<MouseEventHandler<HTMLButtonElement>>[0] | Parameters<MouseEventHandler<HTMLAnchorElement>>[0]) => Promise<void>;
5
- };
6
- export type Size = 'default' | 'xs' | 'sm' | 'lg';
7
- /**
8
- * Map sizes to their icon/normal size variant
9
- */
10
- export declare const sizeMap: {
11
- readonly default: {
12
- readonly icon: "icon";
13
- readonly normal: "default";
14
- };
15
- readonly xs: {
16
- readonly icon: "icon-xs";
17
- readonly normal: "xs";
18
- };
19
- readonly sm: {
20
- readonly icon: "icon-sm";
21
- readonly normal: "sm";
22
- };
23
- readonly lg: {
24
- readonly icon: "icon-lg";
25
- readonly normal: "lg";
26
- };
27
- };
28
- export { type ButtonSize, type ButtonVariant } from './ui/button';
29
- import { Button, type ButtonProps as ButtonPrimitiveProps } from './ui/button';
30
- declare const Button: import("svelte").Component<ButtonProps, {}, "ref">;
31
- type Button = ReturnType<typeof Button>;
32
- export default Button;
@@ -1,7 +0,0 @@
1
- <script lang="ts">
2
- import { ModeWatcher } from "mode-watcher";
3
- let { children } = $props();
4
- </script>
5
-
6
- <ModeWatcher />
7
- {@render children()}
@@ -1,5 +0,0 @@
1
- declare const NegoDesignLayout: import("svelte").Component<{
2
- children: any;
3
- }, {}, "">;
4
- type NegoDesignLayout = ReturnType<typeof NegoDesignLayout>;
5
- export default NegoDesignLayout;