@salesql/sql_components_vue3 3.16.1 → 3.18.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 (39) hide show
  1. package/dist/composables/useViewportClamp.d.ts +9 -4
  2. package/dist/constants/contact-data.d.ts +31 -1
  3. package/dist/constants/events.d.ts +4 -0
  4. package/dist/icons/icons.types.d.ts +38 -0
  5. package/dist/icons/registry.d.ts +30 -0
  6. package/dist/icons/registry.generated.d.ts +4 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +12 -5
  10. package/dist/index.es.js +3839 -2558
  11. package/dist/index.es.js.map +1 -1
  12. package/dist/sql_components_vue3.css +1 -1
  13. package/dist/ui/DsActionMenu/DsActionMenu.vue.d.ts +1 -1
  14. package/dist/ui/DsCheckbox/DsCheckbox.vue.d.ts +1 -1
  15. package/dist/ui/DsContactCell/DsContactCell.types.d.ts +23 -1
  16. package/dist/ui/DsContactCell/DsContactCell.vue.d.ts +55 -1
  17. package/dist/ui/DsContactList/DsContactList.types.d.ts +11 -1
  18. package/dist/ui/DsContactList/DsContactList.vue.d.ts +36 -0
  19. package/dist/ui/DsDeliverabilityBadge/DsDeliverabilityBadge.types.d.ts +10 -2
  20. package/dist/ui/DsDeliverabilityBadge/DsDeliverabilityBadge.vue.d.ts +11 -1
  21. package/dist/ui/DsEmailEditor/DsEmailEditor.types.d.ts +35 -0
  22. package/dist/ui/DsEmailEditor/DsEmailEditor.vue.d.ts +30 -0
  23. package/dist/ui/DsEmailEditor/index.d.ts +2 -0
  24. package/dist/ui/DsIcon/DsIcon.story-weights.d.ts +2 -0
  25. package/dist/ui/DsIcon/DsIcon.types.d.ts +31 -0
  26. package/dist/ui/DsIcon/DsIcon.vue.d.ts +66 -0
  27. package/dist/ui/DsIcon/index.d.ts +2 -0
  28. package/dist/ui/DsInput/DsInput.types.d.ts +1 -0
  29. package/dist/ui/DsPopover/DsPopover.types.d.ts +12 -1
  30. package/dist/ui/DsPopover/DsPopover.vue.d.ts +10 -1
  31. package/dist/ui/DsSavedButton/DsSavedButton.vue.d.ts +1 -1
  32. package/dist/ui/DsTooltip/DsTooltip.vue.d.ts +9 -0
  33. package/llms-full.txt +325 -81
  34. package/llms.txt +3 -1
  35. package/package.json +10 -2
  36. package/scripts/generate-icons.mjs +107 -0
  37. package/scripts/icons-svg.mjs +185 -0
  38. package/src/icons/NOTICE +8 -0
  39. package/src/icons/manifest.json +138 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesql/sql_components_vue3",
3
- "version": "3.16.1",
3
+ "version": "3.18.0",
4
4
  "description": "Librería de componentes Vue 3 (SalesQL)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -15,11 +15,18 @@
15
15
  "./dist/style.css": "./dist/sql_components_vue3.css",
16
16
  "./dist/reset.css": "./dist/reset.css"
17
17
  },
18
+ "bin": {
19
+ "salesql-icons": "./scripts/generate-icons.mjs"
20
+ },
18
21
  "files": [
19
22
  "dist",
20
23
  "README.md",
21
24
  "llms.txt",
22
- "llms-full.txt"
25
+ "llms-full.txt",
26
+ "src/icons/NOTICE",
27
+ "src/icons/manifest.json",
28
+ "scripts/generate-icons.mjs",
29
+ "scripts/icons-svg.mjs"
23
30
  ],
24
31
  "sideEffects": [
25
32
  "**/*.css",
@@ -64,6 +71,7 @@
64
71
  "build": "pnpm docs:generate && vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias -p tsconfig.build.json",
65
72
  "check:dts": "node build/checkNoAliasInDts.mjs",
66
73
  "docs:generate": "node scripts/generate-llms-docs.mjs",
74
+ "icons:generate": "node scripts/generate-icons.mjs",
67
75
  "dev:link": "vite build --watch",
68
76
  "stories": "histoire dev",
69
77
  "build:stories": "histoire build",
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ // =============================================================================
3
+ // generate-icons.mjs — builds Material Symbols registries from src/icons/manifest.json.
4
+ //
5
+ // Downloads the official SVGs from google/material-design-icons (pinned to the manifest's commit
6
+ // SHA) and keeps only the path data. The library registry is COMMITTED: build and tests never
7
+ // touch the network.
8
+ //
9
+ // pnpm icons:generate rebuild src/icons/registry.generated.ts (weight 500)
10
+ // salesql-icons --weight 600 --names error,info --out src/icons/weight600.generated.ts
11
+ // a module for an app: registerIcons(ICONS)
12
+ //
13
+ // --weight <100..700> default 500
14
+ // --names a,b,c default: the manifest icons
15
+ // --families outlined,rounded default: the manifest families of each icon (both for others)
16
+ // --out <path> write an app module instead of the library registry
17
+ //
18
+ // manifest.json: { "sha": "<40 hex>", "aliases": { "email": "mail" },
19
+ // "icons": { "<name>": { "families": ["rounded"] } } }
20
+ // =============================================================================
21
+
22
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
23
+ import { dirname, join, resolve } from 'node:path';
24
+ import { fileURLToPath } from 'node:url';
25
+ import {
26
+ DEFAULT_WEIGHT,
27
+ iconUrls,
28
+ parseCliArgs,
29
+ parseSvg,
30
+ renderIconModule,
31
+ renderRegistry,
32
+ toPathEntry,
33
+ validateManifest,
34
+ } from './icons-svg.mjs';
35
+
36
+ const ICONS_DIR = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'src', 'icons');
37
+ const CONCURRENCY = 8;
38
+ const RETRIES = 3;
39
+ const ALL_FAMILIES = ['outlined', 'rounded'];
40
+
41
+ async function download(url) {
42
+ for (let attempt = 1; ; attempt++) {
43
+ try {
44
+ const res = await fetch(url);
45
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
46
+ return await res.text();
47
+ } catch (error) {
48
+ if (attempt >= RETRIES) throw new Error(`${url}: ${error.message}`);
49
+ await new Promise((done) => setTimeout(done, 400 * attempt));
50
+ }
51
+ }
52
+ }
53
+
54
+ async function buildFamily(sha, name, family, weight) {
55
+ const urls = iconUrls(sha, name, family, weight);
56
+ const drawings = {};
57
+ for (const [key, url] of Object.entries(urls)) {
58
+ try {
59
+ drawings[key] = toPathEntry(parseSvg(await download(url)));
60
+ } catch (error) {
61
+ throw new Error(`${name} (${family}, ${key}): ${error.message}`);
62
+ }
63
+ }
64
+ return drawings;
65
+ }
66
+
67
+ async function main() {
68
+ if (typeof fetch !== 'function') throw new Error('Node 18 or newer is required (global fetch)');
69
+ const { weight, names, families, out } = parseCliArgs(process.argv.slice(2));
70
+ const manifest = JSON.parse(await readFile(join(ICONS_DIR, 'manifest.json'), 'utf8'));
71
+ validateManifest(manifest);
72
+
73
+ const manifestFamilies = (name) => manifest.icons[name]?.families ?? ALL_FAMILIES;
74
+ const wanted = names ?? Object.keys(manifest.icons);
75
+ const jobs = wanted.flatMap((name) =>
76
+ (families ?? manifestFamilies(name)).map((family) => ({ name, family }))
77
+ );
78
+ const icons = {};
79
+ let next = 0;
80
+ await Promise.all(
81
+ Array.from({ length: CONCURRENCY }, async () => {
82
+ while (next < jobs.length) {
83
+ const { name, family } = jobs[next++];
84
+ const drawings = await buildFamily(manifest.sha, name, family, weight);
85
+ icons[name] ??= {};
86
+ icons[name][family] = { [weight]: drawings };
87
+ }
88
+ })
89
+ );
90
+
91
+ const target = out ? resolve(process.cwd(), out) : join(ICONS_DIR, 'registry.generated.ts');
92
+ const source = out
93
+ ? renderIconModule({ sha: manifest.sha, icons })
94
+ : renderRegistry({ sha: manifest.sha, aliases: manifest.aliases ?? {}, icons });
95
+ await mkdir(dirname(target), { recursive: true });
96
+ await writeFile(target, source, 'utf8');
97
+ console.log(
98
+ `${out ?? 'registry.generated.ts'}: weight ${weight}${weight === DEFAULT_WEIGHT ? ' (default)' : ''}, ` +
99
+ `${Object.keys(icons).length} icons, ${jobs.length} families, ` +
100
+ `${(Buffer.byteLength(source) / 1024).toFixed(1)} KB`
101
+ );
102
+ }
103
+
104
+ main().catch((error) => {
105
+ console.error(error.message);
106
+ process.exit(1);
107
+ });
@@ -0,0 +1,185 @@
1
+ // Pure helpers of generate-icons.mjs: URLs, SVG parsing and the registry source. No I/O, so they
2
+ // are unit-tested from build/generateIcons.test.ts.
3
+
4
+ export const DEFAULT_VIEWBOX = '0 -960 960 960';
5
+
6
+ // Same list and default as DS_ICON_WEIGHTS / DEFAULT_ICON_WEIGHT (a test keeps them equal).
7
+ export const ICON_WEIGHTS = [100, 200, 300, 400, 500, 600, 700];
8
+ export const DEFAULT_WEIGHT = 500;
9
+
10
+ const REPO = 'https://raw.githubusercontent.com/google/material-design-icons';
11
+ const FAMILIES = ['outlined', 'rounded'];
12
+ const DRAWING_KEYS = ['compact', 'compactFill', 'regular', 'regularFill'];
13
+ const NAME = /^[a-z][a-z0-9_]*$/;
14
+ const PATH_DATA = /^[MmLlHhVvCcSsQqTtAaZz0-9eE\s,.+-]+$/;
15
+
16
+ // opsz 20 serves sizes 16 and 20; opsz 24 serves size 24. Upstream names the wght 400 files
17
+ // without the `wght` token (`close_20px`, `close_fill1_24px`).
18
+ const FILES = {
19
+ compact: (name, weight) => `${name}${weightToken(weight)}_20px`,
20
+ compactFill: (name, weight) => `${name}${weightToken(weight)}${fillToken(weight)}_20px`,
21
+ regular: (name, weight) => `${name}${weightToken(weight)}_24px`,
22
+ regularFill: (name, weight) => `${name}${weightToken(weight)}${fillToken(weight)}_24px`,
23
+ };
24
+
25
+ function weightToken(weight) {
26
+ return weight === 400 ? '' : `_wght${weight}`;
27
+ }
28
+
29
+ function fillToken(weight) {
30
+ return weight === 400 ? '_fill1' : 'fill1';
31
+ }
32
+
33
+ function assertWeight(weight) {
34
+ if (!ICON_WEIGHTS.includes(weight)) {
35
+ throw new Error(`weight must be one of ${ICON_WEIGHTS.join(', ')} (got ${weight})`);
36
+ }
37
+ }
38
+
39
+ export function iconUrls(sha, name, family, weight = DEFAULT_WEIGHT) {
40
+ assertWeight(weight);
41
+ const dir = `${REPO}/${sha}/symbols/web/${name}/materialsymbols${family}`;
42
+ return Object.fromEntries(
43
+ DRAWING_KEYS.map((key) => [key, `${dir}/${FILES[key](name, weight)}.svg`])
44
+ );
45
+ }
46
+
47
+ export function parseSvg(svg) {
48
+ const unsupported = svg.match(/<(?!svg\b|path\b|\/)([a-z][\w:-]*)/i);
49
+ if (unsupported) throw new Error(`unsupported element <${unsupported[1]}>`);
50
+
51
+ const paths = svg.match(/<path\b[^>]*>/g) ?? [];
52
+ if (paths.length !== 1) throw new Error(`expected exactly 1 path, found ${paths.length}`);
53
+ const pathMatch = paths[0].match(/^<path\s+d="([^"]*)"\s*\/?>$/);
54
+ if (!pathMatch) throw new Error(`path with attributes other than d: ${paths[0]}`);
55
+ const d = pathMatch[1];
56
+ if (!PATH_DATA.test(d)) throw new Error('invalid path data');
57
+
58
+ const root = svg.match(/<svg\b[^>]*>/)?.[0] ?? '';
59
+ const attr = (name) => root.match(new RegExp(`\\s${name}="([^"]*)"`))?.[1];
60
+ let viewBox = attr('viewBox');
61
+ if (!viewBox) {
62
+ const [width, height] = [attr('width'), attr('height')];
63
+ if (!width || !height) throw new Error('no viewBox and no width/height to derive it');
64
+ viewBox = `0 0 ${width} ${height}`;
65
+ }
66
+ return { d, viewBox };
67
+ }
68
+
69
+ export function toPathEntry({ d, viewBox }) {
70
+ return viewBox === DEFAULT_VIEWBOX ? d : { d, viewBox };
71
+ }
72
+
73
+ export function validateManifest(manifest) {
74
+ if (!/^[0-9a-f]{40}$/.test(manifest.sha ?? '')) {
75
+ throw new Error('manifest sha must be a 40-character commit hash');
76
+ }
77
+ const names = Object.keys(manifest.icons ?? {});
78
+ for (const name of names) {
79
+ if (!NAME.test(name)) throw new Error(`invalid icon name "${name}"`);
80
+ const families = manifest.icons[name].families;
81
+ if (
82
+ !Array.isArray(families) ||
83
+ families.length === 0 ||
84
+ !families.every((f) => FAMILIES.includes(f))
85
+ ) {
86
+ throw new Error(`"${name}": families must be a non-empty list of ${FAMILIES.join(' | ')}`);
87
+ }
88
+ }
89
+ for (const [alias, target] of Object.entries(manifest.aliases ?? {})) {
90
+ if (!NAME.test(alias) || names.includes(alias) || !names.includes(target)) {
91
+ throw new Error(
92
+ `invalid alias "${alias}" -> "${target}": it must target an icon in the manifest`
93
+ );
94
+ }
95
+ }
96
+ }
97
+
98
+ // Every object level sorted by key, so a regeneration only shows real changes.
99
+ function sortKeys(value) {
100
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return value;
101
+ return Object.fromEntries(
102
+ Object.entries(value)
103
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
104
+ .map(([key, entry]) => [key, sortKeys(entry)])
105
+ );
106
+ }
107
+
108
+ const json = (value) => JSON.stringify(sortKeys(value), null, 2);
109
+
110
+ // icons: name -> family -> weight -> { compact, compactFill, regular, regularFill }
111
+ export function renderRegistry({ sha, aliases, icons }) {
112
+ return `// Generated by components/scripts/generate-icons.mjs from manifest.json. Do not edit by hand.
113
+ // Material Symbols by Google, Apache License 2.0 (see NOTICE).
114
+ import type { DsIconRegistry } from './icons.types';
115
+
116
+ export const ICON_SOURCE_SHA = '${sha}';
117
+
118
+ export const ICON_ALIASES: Readonly<Record<string, string>> = ${json(aliases)};
119
+
120
+ export const BUILT_IN_ICONS: DsIconRegistry = ${json(icons)};
121
+ `;
122
+ }
123
+
124
+ // The module an app imports to registerIcons() the weights the library does not ship.
125
+ export function renderIconModule({ sha, icons }) {
126
+ return `// Generated by salesql-icons (@salesql/sql_components_vue3). Do not edit by hand.
127
+ // Material Symbols by Google, Apache License 2.0.
128
+ import type { DsIconMap } from '@salesql/sql_components_vue3';
129
+
130
+ export const ICON_SOURCE_SHA = '${sha}';
131
+
132
+ export const ICONS: DsIconMap = ${json(icons)};
133
+ `;
134
+ }
135
+
136
+ const OPTIONS = ['weight', 'names', 'families', 'out'];
137
+
138
+ function list(option, value) {
139
+ const items = [...new Set(value.split(',').map((item) => item.trim()))];
140
+ if (items.some((item) => item === ''))
141
+ throw new Error(`--${option} needs a comma-separated list`);
142
+ return items;
143
+ }
144
+
145
+ /**
146
+ * Parses the CLI arguments (`--weight 600`, `--names a,b`, `--families rounded`, `--out path`;
147
+ * `--option=value` works too). Without --out the script rebuilds the library's own registry, which
148
+ * only ships the default weight and the whole manifest.
149
+ */
150
+ export function parseCliArgs(argv) {
151
+ const raw = {};
152
+ for (let i = 0; i < argv.length; i++) {
153
+ const [flag, inline] = argv[i].split(/=(.*)/s);
154
+ const option = flag.startsWith('--') ? flag.slice(2) : null;
155
+ if (!OPTIONS.includes(option)) throw new Error(`unknown argument "${argv[i]}"`);
156
+ const value = inline ?? argv[++i];
157
+ if (value === undefined) throw new Error(`--${option} needs a value`);
158
+ raw[option] = value;
159
+ }
160
+
161
+ const weight = raw.weight === undefined ? DEFAULT_WEIGHT : Number(raw.weight);
162
+ if (!ICON_WEIGHTS.includes(weight)) {
163
+ throw new Error(`--weight must be one of ${ICON_WEIGHTS.join(', ')} (got "${raw.weight}")`);
164
+ }
165
+
166
+ const names = raw.names === undefined ? null : list('names', raw.names);
167
+ for (const name of names ?? []) {
168
+ if (!NAME.test(name)) throw new Error(`--names: invalid icon name "${name}"`);
169
+ }
170
+
171
+ const families = raw.families === undefined ? null : list('families', raw.families);
172
+ if (families && !families.every((family) => FAMILIES.includes(family))) {
173
+ throw new Error(`--families must be a list of ${FAMILIES.join(' | ')}`);
174
+ }
175
+
176
+ const out = raw.out === undefined ? null : raw.out;
177
+ if (out === '') throw new Error('--out needs a path');
178
+ if (out === null && (weight !== DEFAULT_WEIGHT || names || families)) {
179
+ throw new Error(
180
+ `--weight (other than ${DEFAULT_WEIGHT}), --names and --families need --out: ` +
181
+ 'the library registry always ships the default weight and the whole manifest'
182
+ );
183
+ }
184
+ return { weight, names, families, out };
185
+ }
@@ -0,0 +1,8 @@
1
+ Material Symbols
2
+ Copyright Google LLC
3
+ https://github.com/google/material-design-icons
4
+
5
+ The path data in registry.generated.ts comes from the Material Symbols SVG files of that
6
+ repository, at the commit pinned in manifest.json. It is extracted from the SVGs without changes
7
+ to the drawings. Licensed under the Apache License, Version 2.0:
8
+ https://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,138 @@
1
+ {
2
+ "sha": "49d4db35df873165d6bd6ba09b063c7dafbac2f4",
3
+ "aliases": {
4
+ "email": "mail",
5
+ "mode_edit": "edit",
6
+ "people_alt": "group",
7
+ "phone": "call",
8
+ "save_alt": "download"
9
+ },
10
+ "icons": {
11
+ "add": {
12
+ "families": ["outlined", "rounded"]
13
+ },
14
+ "alternate_email": {
15
+ "families": ["outlined", "rounded"]
16
+ },
17
+ "apartment": {
18
+ "families": ["outlined", "rounded"]
19
+ },
20
+ "autorenew": {
21
+ "families": ["outlined", "rounded"]
22
+ },
23
+ "business_center": {
24
+ "families": ["outlined", "rounded"]
25
+ },
26
+ "call": {
27
+ "families": ["outlined", "rounded"]
28
+ },
29
+ "check": {
30
+ "families": ["outlined", "rounded"]
31
+ },
32
+ "check_circle": {
33
+ "families": ["outlined", "rounded"]
34
+ },
35
+ "chevron_left": {
36
+ "families": ["outlined", "rounded"]
37
+ },
38
+ "chevron_right": {
39
+ "families": ["outlined", "rounded"]
40
+ },
41
+ "close": {
42
+ "families": ["outlined", "rounded"]
43
+ },
44
+ "content_copy": {
45
+ "families": ["outlined", "rounded"]
46
+ },
47
+ "corporate_fare": {
48
+ "families": ["outlined", "rounded"]
49
+ },
50
+ "dangerous": {
51
+ "families": ["outlined", "rounded"]
52
+ },
53
+ "delete": {
54
+ "families": ["outlined", "rounded"]
55
+ },
56
+ "do_not_disturb_on": {
57
+ "families": ["outlined", "rounded"]
58
+ },
59
+ "download": {
60
+ "families": ["outlined", "rounded"]
61
+ },
62
+ "edit": {
63
+ "families": ["outlined", "rounded"]
64
+ },
65
+ "error": {
66
+ "families": ["outlined", "rounded"]
67
+ },
68
+ "folder": {
69
+ "families": ["outlined", "rounded"]
70
+ },
71
+ "group": {
72
+ "families": ["outlined", "rounded"]
73
+ },
74
+ "info": {
75
+ "families": ["outlined", "rounded"]
76
+ },
77
+ "keyboard_arrow_down": {
78
+ "families": ["outlined", "rounded"]
79
+ },
80
+ "keyboard_arrow_left": {
81
+ "families": ["outlined", "rounded"]
82
+ },
83
+ "keyboard_arrow_right": {
84
+ "families": ["outlined", "rounded"]
85
+ },
86
+ "keyboard_arrow_up": {
87
+ "families": ["outlined", "rounded"]
88
+ },
89
+ "label": {
90
+ "families": ["outlined", "rounded"]
91
+ },
92
+ "language": {
93
+ "families": ["outlined", "rounded"]
94
+ },
95
+ "lock": {
96
+ "families": ["outlined", "rounded"]
97
+ },
98
+ "mail": {
99
+ "families": ["outlined", "rounded"]
100
+ },
101
+ "more_vert": {
102
+ "families": ["outlined", "rounded"]
103
+ },
104
+ "new_releases": {
105
+ "families": ["outlined", "rounded"]
106
+ },
107
+ "search": {
108
+ "families": ["outlined", "rounded"]
109
+ },
110
+ "sell": {
111
+ "families": ["outlined", "rounded"]
112
+ },
113
+ "send": {
114
+ "families": ["outlined", "rounded"]
115
+ },
116
+ "swap_vert": {
117
+ "families": ["outlined", "rounded"]
118
+ },
119
+ "thumb_down": {
120
+ "families": ["outlined", "rounded"]
121
+ },
122
+ "thumb_up": {
123
+ "families": ["outlined", "rounded"]
124
+ },
125
+ "verified": {
126
+ "families": ["outlined", "rounded"]
127
+ },
128
+ "visibility": {
129
+ "families": ["outlined", "rounded"]
130
+ },
131
+ "visibility_off": {
132
+ "families": ["outlined", "rounded"]
133
+ },
134
+ "warning": {
135
+ "families": ["outlined", "rounded"]
136
+ }
137
+ }
138
+ }