@sensorario/sg-components 0.0.7 → 0.0.21

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,23 @@
1
+ # Esportazione e pubblicazione di Storybook
2
+
3
+ Questo progetto include uno script per esportare la build statica di Storybook e copiarla direttamente nel progetto principale simonegentili.com.
4
+
5
+ ## Come pubblicare Storybook
6
+
7
+ 1. **Costruisci ed esporta Storybook:**
8
+
9
+ ```sh
10
+ npm run export-storybook
11
+ ```
12
+
13
+ Questo comando:
14
+ - Esegue la build statica di Storybook (output in `storybook-static`)
15
+ - Copia tutti i file generati in `../simonegentili.com/public/storybook/`
16
+
17
+ 2. **Verifica l'integrazione:**
18
+ - I file statici saranno disponibili in simonegentili.com all'indirizzo `/public/storybook/`.
19
+ - Puoi ora pubblicare o servire il sito principale con Storybook incluso.
20
+
21
+ ## Note
22
+ - Assicurati che la cartella di destinazione esista o che lo script abbia i permessi per crearla.
23
+ - Puoi personalizzare la destinazione modificando `scripts/export-storybook.sh`.
package/dist/index.es.js CHANGED
@@ -1,190 +1,13 @@
1
- //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
- if (typeof require < "u") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- }), n = /* @__PURE__ */ e(((e) => {
6
- var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
7
- function r(e, n, r) {
8
- var i = null;
9
- if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
10
- else r = n;
11
- return n = r.ref, {
12
- $$typeof: t,
13
- type: e,
14
- key: i,
15
- ref: n === void 0 ? null : n,
16
- props: r
17
- };
18
- }
19
- e.Fragment = n, e.jsx = r, e.jsxs = r;
20
- })), r = /* @__PURE__ */ e(((e) => {
21
- process.env.NODE_ENV !== "production" && (function() {
22
- function n(e) {
23
- if (e == null) return null;
24
- if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
25
- if (typeof e == "string") return e;
26
- switch (e) {
27
- case v: return "Fragment";
28
- case b: return "Profiler";
29
- case y: return "StrictMode";
30
- case w: return "Suspense";
31
- case T: return "SuspenseList";
32
- case O: return "Activity";
33
- }
34
- if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
35
- case _: return "Portal";
36
- case S: return e.displayName || "Context";
37
- case x: return (e._context.displayName || "Context") + ".Consumer";
38
- case C:
39
- var t = e.render;
40
- return e = e.displayName, e ||= (e = t.displayName || t.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
41
- case E: return t = e.displayName || null, t === null ? n(e.type) || "Memo" : t;
42
- case D:
43
- t = e._payload, e = e._init;
44
- try {
45
- return n(e(t));
46
- } catch {}
47
- }
48
- return null;
49
- }
50
- function r(e) {
51
- return "" + e;
52
- }
53
- function i(e) {
54
- try {
55
- r(e);
56
- var t = !1;
57
- } catch {
58
- t = !0;
59
- }
60
- if (t) {
61
- t = console;
62
- var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
63
- return n.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), r(e);
64
- }
65
- }
66
- function a(e) {
67
- if (e === v) return "<>";
68
- if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
69
- try {
70
- var t = n(e);
71
- return t ? "<" + t + ">" : "<...>";
72
- } catch {
73
- return "<...>";
74
- }
75
- }
76
- function o() {
77
- var e = A.A;
78
- return e === null ? null : e.getOwner();
79
- }
80
- function s() {
81
- return Error("react-stack-top-frame");
82
- }
83
- function c(e) {
84
- if (j.call(e, "key")) {
85
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
86
- if (t && t.isReactWarning) return !1;
87
- }
88
- return e.key !== void 0;
89
- }
90
- function l(e, t) {
91
- function n() {
92
- P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
93
- }
94
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
95
- get: n,
96
- configurable: !0
97
- });
98
- }
99
- function u() {
100
- var e = n(this.type);
101
- return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
102
- }
103
- function d(e, t, n, r, i, a) {
104
- var o = n.ref;
105
- return e = {
106
- $$typeof: g,
107
- type: e,
108
- key: t,
109
- props: n,
110
- _owner: r
111
- }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
112
- enumerable: !1,
113
- value: null
114
- }) : Object.defineProperty(e, "ref", {
115
- enumerable: !1,
116
- get: u
117
- }), e._store = {}, Object.defineProperty(e._store, "validated", {
118
- configurable: !1,
119
- enumerable: !1,
120
- writable: !0,
121
- value: 0
122
- }), Object.defineProperty(e, "_debugInfo", {
123
- configurable: !1,
124
- enumerable: !1,
125
- writable: !0,
126
- value: null
127
- }), Object.defineProperty(e, "_debugStack", {
128
- configurable: !1,
129
- enumerable: !1,
130
- writable: !0,
131
- value: i
132
- }), Object.defineProperty(e, "_debugTask", {
133
- configurable: !1,
134
- enumerable: !1,
135
- writable: !0,
136
- value: a
137
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
138
- }
139
- function f(e, t, r, a, s, u) {
140
- var f = t.children;
141
- if (f !== void 0) if (a) if (M(f)) {
142
- for (a = 0; a < f.length; a++) p(f[a]);
143
- Object.freeze && Object.freeze(f);
144
- } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
145
- else p(f);
146
- if (j.call(t, "key")) {
147
- f = n(e);
148
- var m = Object.keys(t).filter(function(e) {
149
- return e !== "key";
150
- });
151
- a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
152
- }
153
- if (f = null, r !== void 0 && (i(r), f = "" + r), c(t) && (i(t.key), f = "" + t.key), "key" in t) for (var h in r = {}, t) h !== "key" && (r[h] = t[h]);
154
- else r = t;
155
- return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
156
- }
157
- function p(e) {
158
- m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
159
- }
160
- function m(e) {
161
- return typeof e == "object" && !!e && e.$$typeof === g;
162
- }
163
- var h = t("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
164
- return null;
165
- };
166
- h = { react_stack_bottom_frame: function(e) {
167
- return e();
168
- } };
169
- var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
170
- e.Fragment = v, e.jsx = function(e, t, n) {
171
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
172
- return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
173
- }, e.jsxs = function(e, t, n) {
174
- var r = 1e4 > A.recentlyCreatedOwnerStacks++;
175
- return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
176
- };
177
- })();
178
- })), i = (/* @__PURE__ */ e(((e, t) => {
179
- process.env.NODE_ENV === "production" ? t.exports = n() : t.exports = r();
180
- })))(), a = ({ copyright: e = "© 2026 My Company", links: t = [] }) => /* @__PURE__ */ (0, i.jsxs)("footer", {
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ //#region src/stories/Footer/Footer.tsx
3
+ var n = ({ copyright: n = "© 2026 My Company", links: r = [] }) => /* @__PURE__ */ t("footer", {
181
4
  className: "footer",
182
- children: [/* @__PURE__ */ (0, i.jsx)("span", { children: e }), t.length > 0 && /* @__PURE__ */ (0, i.jsx)("nav", { children: t.map(({ label: e, href: t }) => /* @__PURE__ */ (0, i.jsx)("a", {
183
- href: t,
5
+ children: [/* @__PURE__ */ e("span", { children: n }), r.length > 0 && /* @__PURE__ */ e("nav", { children: r.map(({ label: t, href: n }) => /* @__PURE__ */ e("a", {
6
+ href: n,
184
7
  style: { marginLeft: "16px" },
185
- children: e
186
- }, t)) })]
187
- }), o = [
8
+ children: t
9
+ }, n)) })]
10
+ }), r = [
188
11
  {
189
12
  label: "guitar.simonegentili.com",
190
13
  href: "https://guitar.simonegentili.com"
@@ -201,9 +24,9 @@ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
201
24
  label: "code2image.simonegentili.com",
202
25
  href: "https://code2image.simonegentili.com"
203
26
  }
204
- ], s = () => /* @__PURE__ */ (0, i.jsx)(a, {
27
+ ], i = () => /* @__PURE__ */ e(n, {
205
28
  copyright: "© 2026 simonegentili.com",
206
- links: o
29
+ links: r
207
30
  });
208
31
  //#endregion
209
- export { a as Footer, s as SGFooter };
32
+ export { n as Footer, i as SGFooter };
package/global.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ declare module '*.css' {
2
+ const content: Record<string, string>;
3
+ export default content;
4
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sensorario/sg-components",
3
3
  "private": false,
4
- "version": "0.0.7",
4
+ "version": "0.0.21",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -11,6 +11,8 @@
11
11
  "preview": "vite preview",
12
12
  "storybook": "storybook dev -p 6006",
13
13
  "build-storybook": "storybook build"
14
+ ,
15
+ "export-storybook": "bash ./scripts/export-storybook.sh"
14
16
  },
15
17
  "main": "dist/index.es.js",
16
18
  "module": "dist/index.es.js",
@@ -28,6 +30,9 @@
28
30
  "devDependencies": {
29
31
  "@chromatic-com/storybook": "^5.2.1",
30
32
  "@eslint/js": "^10.0.1",
33
+ "@rollup/plugin-commonjs": "^29.0.2",
34
+ "@rollup/plugin-node-resolve": "^16.0.3",
35
+ "@rollup/plugin-typescript": "^12.3.0",
31
36
  "@storybook/addon-a11y": "^10.4.1",
32
37
  "@storybook/addon-docs": "^10.4.1",
33
38
  "@storybook/addon-mcp": "^0.6.0",
@@ -45,6 +50,10 @@
45
50
  "eslint-plugin-storybook": "^10.4.1",
46
51
  "globals": "^17.6.0",
47
52
  "playwright": "^1.60.0",
53
+ "rollup": "^4.60.4",
54
+ "rollup-plugin-dts": "^6.4.1",
55
+ "rollup-plugin-peer-deps-external": "^2.2.4",
56
+ "rollup-plugin-postcss": "^4.0.2",
48
57
  "storybook": "^10.4.1",
49
58
  "typescript": "~6.0.2",
50
59
  "typescript-eslint": "^8.59.2",
@@ -0,0 +1,23 @@
1
+ import typescript from '@rollup/plugin-typescript';
2
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
3
+ import { nodeResolve } from '@rollup/plugin-node-resolve';
4
+ import postcss from 'rollup-plugin-postcss';
5
+ import dts from 'rollup-plugin-dts';
6
+
7
+ export default {
8
+ input: 'src/index.ts',
9
+ output: [
10
+ {
11
+ file: 'dist/index.es.js',
12
+ format: 'es',
13
+ sourcemap: true,
14
+ },
15
+ ],
16
+ plugins: [
17
+ peerDepsExternal(),
18
+ nodeResolve(),
19
+ postcss(),
20
+ typescript({ tsconfig: './tsconfig.build.json' }),
21
+ ],
22
+ external: ['react', 'react-dom'],
23
+ };
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ # Script per esportare la build statica di Storybook in simonegentili.com
3
+
4
+ # Costanti
5
+ STORYBOOK_DIR="storybook-static"
6
+ DEST_DIR="../simonegentili.com/public/storybook"
7
+
8
+ # Build Storybook
9
+ npm run build-storybook
10
+
11
+ # Crea la cartella di destinazione se non esiste
12
+ mkdir -p "$DEST_DIR"
13
+
14
+ # Copia la build statica
15
+ cp -r "$STORYBOOK_DIR"/* "$DEST_DIR"/
16
+
17
+ echo "Storybook esportato in $DEST_DIR"
package/vite.config.ts CHANGED
@@ -5,8 +5,6 @@ import react from '@vitejs/plugin-react';
5
5
  // https://vite.dev/config/
6
6
  import path from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
- import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
9
- import { playwright } from '@vitest/browser-playwright';
10
8
  const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
11
9
 
12
10
  // More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
@@ -20,35 +18,19 @@ export default defineConfig({
20
18
  formats: ['es']
21
19
  },
22
20
  rollupOptions: {
23
- external: ['react', 'react-dom'],
21
+ external: ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
24
22
  output: {
25
23
  globals: {
26
24
  react: 'React',
27
25
  'react-dom': 'ReactDOM',
26
+ 'react/jsx-runtime': 'ReactJsxRuntime',
27
+ 'react/jsx-dev-runtime': 'ReactJsxDevRuntime',
28
28
  },
29
29
  },
30
30
  },
31
+ commonjsOptions: {
32
+ transformMixedEsModules: true
33
+ }
31
34
  },
32
- test: {
33
- projects: [{
34
- extends: true,
35
- plugins: [
36
- // The plugin will run tests for the stories defined in your Storybook config
37
- // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
38
- storybookTest({
39
- configDir: path.join(dirname, '.storybook')
40
- })],
41
- test: {
42
- name: 'storybook',
43
- browser: {
44
- enabled: true,
45
- headless: true,
46
- provider: playwright({}),
47
- instances: [{
48
- browser: 'chromium'
49
- }]
50
- }
51
- }
52
- }]
53
- }
35
+ // test config temporaneamente rimossa per build ESM pulita
54
36
  });