@wrrdev/fenix-ui 1.0.3 → 1.0.5

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.
@@ -0,0 +1,82 @@
1
+ const fenixComponentMap = {
2
+ "fx-button": "@wrrdev/fenix-ui/button",
3
+ "fx-badge": "@wrrdev/fenix-ui/badge",
4
+ "fx-spinner": "@wrrdev/fenix-ui/spinner",
5
+ "fx-select": "@wrrdev/fenix-ui/select",
6
+ "fx-multiselect": "@wrrdev/fenix-ui/multiselect",
7
+ "fx-input": "@wrrdev/fenix-ui/input",
8
+ "fx-switch": "@wrrdev/fenix-ui/switch",
9
+ "fx-calendar": "@wrrdev/fenix-ui/calendar",
10
+ "fx-datepicker": "@wrrdev/fenix-ui/datepicker",
11
+ "fx-checkbox": "@wrrdev/fenix-ui/checkbox",
12
+ "fx-radio": "@wrrdev/fenix-ui/radio",
13
+ "fx-table": "@wrrdev/fenix-ui/table",
14
+ "fx-floatlabel": "@wrrdev/fenix-ui/floatlabel",
15
+ "fx-textarea": "@wrrdev/fenix-ui/textarea",
16
+ "fx-dialog": "@wrrdev/fenix-ui/dialog",
17
+ "fx-drawer": "@wrrdev/fenix-ui/drawer",
18
+ "fx-toast": "@wrrdev/fenix-ui/toast",
19
+ "fx-tooltip": "@wrrdev/fenix-ui/tooltip",
20
+ "fx-tabs": "@wrrdev/fenix-ui/tabs",
21
+ "fx-tab-panel": "@wrrdev/fenix-ui/tabs",
22
+ "fx-progress": "@wrrdev/fenix-ui/progress",
23
+ "fx-skeleton": "@wrrdev/fenix-ui/skeleton",
24
+ "fx-alert": "@wrrdev/fenix-ui/alert",
25
+ "fx-dropdown": "@wrrdev/fenix-ui/dropdown",
26
+ "fx-dropdown-item": "@wrrdev/fenix-ui/dropdown",
27
+ "fx-pagination": "@wrrdev/fenix-ui/pagination",
28
+ "fx-autocomplete": "@wrrdev/fenix-ui/autocomplete"
29
+ };
30
+ const TAG_RE = /<(fx-[a-z][a-z-]*)(?=[\s/>])/g;
31
+ function transformSource(code, options = {}) {
32
+ const pkg = options.packageName ?? "@wrrdev/fenix-ui";
33
+ const resolve = (sub) => pkg === "@wrrdev/fenix-ui" ? sub : sub.replace("@wrrdev/fenix-ui", pkg);
34
+ const needed = /* @__PURE__ */ new Set();
35
+ for (const m of code.matchAll(TAG_RE)) {
36
+ const sub = fenixComponentMap[m[1]];
37
+ if (sub) {
38
+ const target = resolve(sub);
39
+ if (!code.includes(`'${target}'`) && !code.includes(`"${target}"`)) {
40
+ needed.add(target);
41
+ }
42
+ }
43
+ }
44
+ if (!needed.size) return code;
45
+ const lines = [...needed].map((s) => `import '${s}';`);
46
+ const vueScript = /(<script[^>]*>)\n/.exec(code);
47
+ if (vueScript) {
48
+ return code.replace(vueScript[0], `${vueScript[1]}
49
+ ${lines.join("\n")}
50
+ `);
51
+ }
52
+ let lastEnd = -1;
53
+ for (const m of code.matchAll(/^[ \t]*import\b[^;]*?['"][^'"]+['"];?[^\S\n]*$/gm)) {
54
+ lastEnd = Math.max(lastEnd, m.index + m[0].length);
55
+ }
56
+ if (lastEnd === -1) return `${lines.join("\n")}
57
+ ${code}`;
58
+ return `${code.slice(0, lastEnd)}
59
+ ${lines.join("\n")}${code.slice(lastEnd)}`;
60
+ }
61
+ function shouldTransform(id) {
62
+ return !id.includes("node_modules") && !id.endsWith(".d.ts") && !id.endsWith(".css") && /\.(ts|js|tsx|jsx|vue|html|svelte)$/.test(id);
63
+ }
64
+ function FenixAutoImport(options = {}) {
65
+ return {
66
+ name: "fenix-ui-auto-import",
67
+ enforce: "pre",
68
+ transform(code, id) {
69
+ if (!shouldTransform(id)) return void 0;
70
+ const result = transformSource(code, options);
71
+ if (result === code) return void 0;
72
+ return { code: result, map: null };
73
+ }
74
+ };
75
+ }
76
+ export {
77
+ FenixAutoImport,
78
+ fenixComponentMap,
79
+ shouldTransform,
80
+ transformSource
81
+ };
82
+ //# sourceMappingURL=fenix-ui3.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fenix-ui3.esm.js","sources":["../src/plugins/auto-import.ts","../src/plugins/index.ts"],"sourcesContent":["/**\r\n * Registro de tags → subpaths para o auto-import.\r\n * Mantido em um módulo próprio (sem depender de DOM) para ser usado\r\n * também no build do cliente via plugin.\r\n */\r\nexport const fenixComponentMap: Record<string, string> = {\r\n 'fx-button': '@wrrdev/fenix-ui/button',\r\n 'fx-badge': '@wrrdev/fenix-ui/badge',\r\n 'fx-spinner': '@wrrdev/fenix-ui/spinner',\r\n 'fx-select': '@wrrdev/fenix-ui/select',\r\n 'fx-multiselect': '@wrrdev/fenix-ui/multiselect',\r\n 'fx-input': '@wrrdev/fenix-ui/input',\r\n 'fx-switch': '@wrrdev/fenix-ui/switch',\r\n 'fx-calendar': '@wrrdev/fenix-ui/calendar',\r\n 'fx-datepicker': '@wrrdev/fenix-ui/datepicker',\r\n 'fx-checkbox': '@wrrdev/fenix-ui/checkbox',\r\n 'fx-radio': '@wrrdev/fenix-ui/radio',\r\n 'fx-table': '@wrrdev/fenix-ui/table',\r\n 'fx-floatlabel': '@wrrdev/fenix-ui/floatlabel',\r\n 'fx-textarea': '@wrrdev/fenix-ui/textarea',\r\n 'fx-dialog': '@wrrdev/fenix-ui/dialog',\r\n 'fx-drawer': '@wrrdev/fenix-ui/drawer',\r\n 'fx-toast': '@wrrdev/fenix-ui/toast',\r\n 'fx-tooltip': '@wrrdev/fenix-ui/tooltip',\r\n 'fx-tabs': '@wrrdev/fenix-ui/tabs',\r\n 'fx-tab-panel': '@wrrdev/fenix-ui/tabs',\r\n 'fx-progress': '@wrrdev/fenix-ui/progress',\r\n 'fx-skeleton': '@wrrdev/fenix-ui/skeleton',\r\n 'fx-alert': '@wrrdev/fenix-ui/alert',\r\n 'fx-dropdown': '@wrrdev/fenix-ui/dropdown',\r\n 'fx-dropdown-item': '@wrrdev/fenix-ui/dropdown',\r\n 'fx-pagination': '@wrrdev/fenix-ui/pagination',\r\n 'fx-autocomplete': '@wrrdev/fenix-ui/autocomplete',\r\n};\r\n\r\nconst TAG_RE = /<(fx-[a-z][a-z-]*)(?=[\\s/>])/g;\r\n\r\nexport interface AutoImportOptions {\r\n /** Prefixo do pacote (padrão '@wrrdev/fenix-ui'). */\r\n packageName?: string;\r\n}\r\n\r\n/**\r\n * Injeta `import '<subpath>'` para cada componente fx-* usado no código\r\n * que ainda não foi importado. Retorna o código transformado ou o original.\r\n */\r\nexport function transformSource(code: string, options: AutoImportOptions = {}): string {\r\n const pkg = options.packageName ?? '@wrrdev/fenix-ui';\r\n // Subpaths do mapa são reescritos quando um pacote custom é informado.\r\n const resolve = (sub: string): string =>\r\n pkg === '@wrrdev/fenix-ui' ? sub : sub.replace('@wrrdev/fenix-ui', pkg);\r\n\r\n // Componentes usados e ainda não importados explicitamente.\r\n const needed = new Set<string>();\r\n for (const m of code.matchAll(TAG_RE)) {\r\n const sub = fenixComponentMap[m[1]];\r\n if (sub) {\r\n const target = resolve(sub);\r\n if (!code.includes(`'${target}'`) && !code.includes(`\"${target}\"`)) {\r\n needed.add(target);\r\n }\r\n }\r\n }\r\n if (!needed.size) return code;\r\n\r\n const lines = [...needed].map((s) => `import '${s}';`);\r\n\r\n // Arquivo único (.vue): injeta logo após a abertura do <script>.\r\n const vueScript = /(<script[^>]*>)\\n/.exec(code);\r\n if (vueScript) {\r\n return code.replace(vueScript[0], `${vueScript[1]}\\n${lines.join('\\n')}\\n`);\r\n }\r\n\r\n // TS/JS: injeta após o último import existente (ou no topo).\r\n let lastEnd = -1;\r\n for (const m of code.matchAll(/^[ \\t]*import\\b[^;]*?['\"][^'\"]+['\"];?[^\\S\\n]*$/gm)) {\r\n lastEnd = Math.max(lastEnd, m.index + m[0].length);\r\n }\r\n if (lastEnd === -1) return `${lines.join('\\n')}\\n${code}`;\r\n return `${code.slice(0, lastEnd)}\\n${lines.join('\\n')}${code.slice(lastEnd)}`;\r\n}\r\n\r\n/** Verifica se o arquivo deve ser transformado. */\r\nexport function shouldTransform(id: string): boolean {\r\n return (\r\n !id.includes('node_modules') &&\r\n !id.endsWith('.d.ts') &&\r\n !id.endsWith('.css') &&\r\n /\\.(ts|js|tsx|jsx|vue|html|svelte)$/.test(id)\r\n );\r\n}\r\n\r\n","/**\n * Plugin de AUTO-IMPORT para Vite/Rollup.\n *\n * O usuário escreve apenas `<fx-button>`, `<fx-select>` etc. no template/código;\n * este plugin detecta as tags em tempo de build e injeta os imports dos\n * subpaths correspondentes — mantendo o tree-shaking (só entra no bundle\n * o que é usado).\n *\n * Uso no projeto do cliente (vite.config.ts):\n * import { FenixAutoImport } from '@wrrdev/fenix-ui/auto-import';\n * export default { plugins: [FenixAutoImport()] };\n */\nimport {\n transformSource,\n shouldTransform,\n type AutoImportOptions,\n} from './auto-import';\n\nexport interface FenixPlugin {\n name: string;\n enforce: 'pre';\n transform: (\n code: string,\n id: string,\n ) => { code: string; map: null } | undefined;\n}\n\nexport function FenixAutoImport(options: AutoImportOptions = {}): FenixPlugin {\n return {\n name: 'fenix-ui-auto-import',\n enforce: 'pre',\n transform(code, id) {\n if (!shouldTransform(id)) return undefined;\n const result = transformSource(code, options);\n if (result === code) return undefined;\n return { code: result, map: null };\n },\n };\n}\n\nexport { transformSource, shouldTransform, fenixComponentMap } from './auto-import';\nexport type { AutoImportOptions } from './auto-import';\n"],"names":[],"mappings":"AAKO,MAAM,oBAA4C;AAAA,EACvD,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,eAAe;AAAA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S,gBAAgB,IAAqB;AACnD,SACE,CAAC,GAAG,SAAS,cAAc,KAC3B,CAAC,GAAG,SAAS,OAAO,KACpB,CAAC,GAAG,SAAS,MAAM,KACnB,qCAAqC,KAAK,EAAE;AAEhD;AC/DO,SAAS,gBAAgB,UAA6B,IAAiB;AAC5E,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU,MAAM,IAAI;AAClB,UAAI,CAAC,gBAAgB,EAAE,EAAG,QAAO;AACjC,YAAM,SAAS,gBAAgB,MAAM,OAAO;AAC5C,UAAI,WAAW,KAAM,QAAO;AAC5B,aAAO,EAAE,MAAM,QAAQ,KAAK,KAAA;AAAA,IAC9B;AAAA,EAAA;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ export * from './core/presets';
11
11
  export * from './core/css';
12
12
  export * from './core/base';
13
13
  export * from './core/define';
14
+ export * from './core/types';
15
+ export * from './core/jsx';
14
16
  export * from './components/button';
15
17
  export * from './components/badge';
16
18
  export * from './components/spinner';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAG9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB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Ac,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { applyPreset, defineCustomPreset, listPresets, themePresets } from "./co
4
4
  import { css, kebabToCamel } from "./core/css.js";
5
5
  import { FxElement } from "./core/base.js";
6
6
  import { defineElement } from "./core/define.js";
7
+ import { FX_JSX_TYPES } from "./core/jsx.js";
7
8
  import "./components/button/index.js";
8
9
  import "./components/badge/index.js";
9
10
  import "./components/spinner/index.js";
@@ -55,6 +56,7 @@ import { FxTable } from "./components/table/table.js";
55
56
  import { FxTextarea } from "./components/textarea/textarea.js";
56
57
  import { FxTooltip } from "./components/tooltip/tooltip.js";
57
58
  export {
59
+ FX_JSX_TYPES,
58
60
  FenixToast,
59
61
  FenixUI,
60
62
  FxAlert,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,19 +1,24 @@
1
1
  {
2
2
  "name": "@wrrdev/fenix-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "FenixUI Design System Web nativo (Web Components + Shadow DOM + Design Tokens) com tree-shaking por componente.",
5
5
  "type": "module",
6
6
  "license": "ISC",
7
- "keywords":["UI", "UX", "Componentes", "Fenix", "FenixUI"],
8
- "files": [
7
+ "keywords": [
8
+ "UI",
9
+ "UX",
10
+ "Componentes",
11
+ "Fenix",
12
+ "FenixUI"
13
+ ],
14
+ "files": [
9
15
  "dist",
10
16
  "README.md"
11
17
  ],
12
- "publishConfig": {
18
+ "publishConfig": {
13
19
  "access": "public",
14
20
  "tag": "latest"
15
21
  },
16
-
17
22
  "main": "./dist/index.js",
18
23
  "module": "./dist/index.js",
19
24
  "types": "./dist/index.d.ts",
@@ -139,6 +144,14 @@
139
144
  "types": "./dist/plugins/index.d.ts",
140
145
  "import": "./dist/plugins/index.js"
141
146
  },
147
+ "./jsx": {
148
+ "types": "./dist/core/jsx.d.ts",
149
+ "import": "./dist/core/jsx.js"
150
+ },
151
+ "./vue": {
152
+ "types": "./dist/core/vue.d.ts",
153
+ "import": "./dist/core/vue.js"
154
+ },
142
155
  "./components/*": {
143
156
  "types": "./dist/components/*/index.d.ts",
144
157
  "import": "./dist/components/*/index.js"
@@ -159,11 +172,14 @@
159
172
  "publish": "npm publish --access public --tag latest"
160
173
  },
161
174
  "devDependencies": {
175
+ "@babel/types": "^8.0.4",
162
176
  "@types/node": "^22.7.4",
163
177
  "jsdom": "^25.0.1",
164
178
  "typescript": "^5.6.2",
165
179
  "vite": "^5.4.8",
166
- "vitest": "^2.1.2"
180
+ "vitest": "^2.1.2",
181
+ "vue": "^3.5.13",
182
+ "vue-tsc": "^3.0.4"
167
183
  },
168
184
  "dependencies": {
169
185
  "postcss": "^8.5.26"