@birdycom/omniaui 0.12.1 → 0.12.3
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.
- package/README.md +2 -1
- package/bin/lib/copy-js.mjs +56 -0
- package/bin/omniaui.mjs +6 -2
- package/dist/carousel.js +11 -2
- package/dist/components.css +494 -6
- package/dist/components.min.css +1 -1
- package/dist/data-table.js +11 -2
- package/dist/oc-theme.css +1 -1
- package/dist/parts/app-status-dot.css +50 -0
- package/dist/parts/app-titlebar.css +96 -0
- package/dist/parts/media-glass.css +71 -0
- package/dist/parts/media-live-frame.css +38 -0
- package/dist/parts/media-watermark.css +96 -0
- package/dist/parts/site-link-row.css +54 -0
- package/dist/parts/site-prose.css +12 -0
- package/manifest.json +48 -0
- package/package.json +2 -2
- package/snippets/glass.html +24 -0
- package/snippets/link-row.html +14 -0
- package/snippets/live-frame.html +20 -0
- package/snippets/status-dot.html +15 -0
- package/snippets/titlebar.html +29 -0
- package/snippets/watermark.html +40 -0
package/README.md
CHANGED
|
@@ -15,7 +15,8 @@ Plus buttons, cards, badges, alerts, forms, avatar, progress, breadcrumb, pagina
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install @birdycom/omniaui # import "@birdycom/omniaui"
|
|
18
|
-
npx
|
|
18
|
+
npx omniaui add modal # copy a component into your project (HTML, React, Vue or Blade)
|
|
19
|
+
npx omniaui copy-js # the scripts (data table, carousel) to public/js/oc-*.js
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
MIT
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// File: packages/ui/bin/lib/copy-js.mjs
|
|
2
|
+
// `omniaui copy-js`: copy the scripts of the installed OmniaUI packages into the project's public folder as
|
|
3
|
+
// oc-<name>.js, the name that makes them start on their own from a plain <script type="module"> tag.
|
|
4
|
+
// Map: scripts per package -> installed ones -> target folder (Laravel/Vite: public/js) -> copy (--force, --dry-run) -> script tags
|
|
5
|
+
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { cwd, exists, pkgDir, posix } from "./project.mjs";
|
|
9
|
+
|
|
10
|
+
/** [package, file in the package, name in the project, what it does]. */
|
|
11
|
+
const SCRIPTS = [
|
|
12
|
+
["@birdycom/omniaui", "dist/data-table.js", "oc-data-table.js", "list table: sort, filter, select, paginate"],
|
|
13
|
+
["@birdycom/omniaui", "dist/carousel.js", "oc-carousel.js", "looping carousel (.oc-carousel--loop)"],
|
|
14
|
+
["@birdycom/omniaui-pro", "dist/spotlight.js", "oc-spotlight.js", "spotlight cards (Pro)"],
|
|
15
|
+
["@birdycom/omniaui-pro", "dist/ecosystem-map.js", "oc-ecosystem-map.js", "ecosystem map lines (Pro)"],
|
|
16
|
+
["@birdycom/omniaui-pro", "dist/infinite-carousel.js", "oc-infinite-carousel.js", "infinite carousel (Pro)"],
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/** public/js when the project has a public folder (Laravel, Vite, Astro …), else js. */
|
|
20
|
+
async function defaultJsDir() {
|
|
21
|
+
return (await exists(path.join(cwd, "public"))) ? "public/js" : "js";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function cmdCopyJs(names, flags) {
|
|
25
|
+
const dir = path.resolve(cwd, flags.to || flags.dir || (await defaultJsDir()));
|
|
26
|
+
const wanted = names.map((n) => n.replace(/^oc-|\.js$/g, ""));
|
|
27
|
+
const picked = SCRIPTS.filter(([, , target]) => !wanted.length || wanted.includes(target.replace(/^oc-|\.js$/g, "")));
|
|
28
|
+
if (wanted.length && picked.length !== wanted.length) {
|
|
29
|
+
const known = SCRIPTS.map(([, , t]) => t.replace(/^oc-|\.js$/g, ""));
|
|
30
|
+
throw new Error(`unknown script: ${wanted.filter((w) => !known.includes(w)).join(", ")} (known: ${known.join(", ")})`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const copied = [];
|
|
34
|
+
for (const [pkg, file, target, what] of picked) {
|
|
35
|
+
let from;
|
|
36
|
+
try { from = path.join(pkgDir(pkg), file); } catch { if (wanted.length) console.log(`skip ${target}: ${pkg} is not installed`); continue; }
|
|
37
|
+
if (!(await exists(from))) continue;
|
|
38
|
+
const to = path.join(dir, target);
|
|
39
|
+
const rel = posix(path.relative(cwd, to));
|
|
40
|
+
if ((await exists(to)) && !flags.force && !flags["dry-run"]) { console.log(`skip ${rel} (exists, use --force)`); continue; }
|
|
41
|
+
if (!flags["dry-run"]) {
|
|
42
|
+
await fs.mkdir(dir, { recursive: true });
|
|
43
|
+
await fs.copyFile(from, to);
|
|
44
|
+
}
|
|
45
|
+
console.log(`${flags["dry-run"] ? "would copy" : "copied"} ${rel} (${what})`);
|
|
46
|
+
copied.push(target);
|
|
47
|
+
}
|
|
48
|
+
if (!copied.length) {
|
|
49
|
+
console.log("No scripts copied. They come with @birdycom/omniaui and @birdycom/omniaui-pro: install those first.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// The URL the page uses: the folder under public/ is served from the site root.
|
|
53
|
+
const base = "/" + posix(path.relative(path.join(cwd, "public"), dir)).replace(/^(\.\.\/)+/, "");
|
|
54
|
+
console.log(`\nLoad the ones a page needs; each starts on its own:`);
|
|
55
|
+
for (const target of copied) console.log(` <script type="module" src="${base}/${target}"></script>`);
|
|
56
|
+
}
|
package/bin/omniaui.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// File: packages/ui/bin/omniaui.mjs
|
|
3
3
|
// OmniaUI CLI — copy components and blocks into your project (css | vue | react | blade), list the registry.
|
|
4
|
-
// Map: args -> commands (add | list | help | version) -> lib/add.mjs (lib/catalog.mjs, lib/project.mjs)
|
|
4
|
+
// Map: args -> commands (add | list | copy-js | help | version) -> lib/add.mjs (lib/catalog.mjs, lib/project.mjs), lib/copy-js.mjs
|
|
5
5
|
// Author: Serge Cools | Framework: OmniaUI (on OmniaCSS)
|
|
6
6
|
//
|
|
7
7
|
// These commands used to be "omniacss add/list" (moved here in October 2026). The CSS build stays in
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { parseArgs } from "node:util";
|
|
11
11
|
import { cmdAdd, cmdList } from "./lib/add.mjs";
|
|
12
|
+
import { cmdCopyJs } from "./lib/copy-js.mjs";
|
|
12
13
|
import { readJson } from "./lib/project.mjs";
|
|
13
14
|
|
|
14
15
|
const HELP = `
|
|
@@ -18,6 +19,8 @@ OmniaUI CLI
|
|
|
18
19
|
copy components/blocks into your project (you own the code)
|
|
19
20
|
omniaui add <name...> -f vue --import print the import line for the npm package instead
|
|
20
21
|
omniaui list [blocks|components] [-f vue] show what can be added in a flavour
|
|
22
|
+
omniaui copy-js [name...] [--to public/js] copy the scripts (data table, carousel; Pro: spotlight, ecosystem map,
|
|
23
|
+
infinite carousel) as oc-<name>.js, which start on their own from a script tag
|
|
21
24
|
|
|
22
25
|
Options:
|
|
23
26
|
-f, --framework <fw> css | vue | react | blade (default: "framework" in omnia.config.json, else detected
|
|
@@ -26,7 +29,7 @@ Options:
|
|
|
26
29
|
--dir <dir> target folder (alias --to); defaults per flavour:
|
|
27
30
|
vue/react: resources/js/components/oc (Laravel) or src/components/oc,
|
|
28
31
|
css: resources/views/oc-snippets (Laravel) or oc-snippets,
|
|
29
|
-
blade: resources/views/components/oc
|
|
32
|
+
blade: resources/views/components/oc; copy-js: public/js (or js)
|
|
30
33
|
--all add every component (or block with --kind block)
|
|
31
34
|
--force overwrite existing files
|
|
32
35
|
--dry-run show what would be copied
|
|
@@ -60,6 +63,7 @@ async function main() {
|
|
|
60
63
|
switch (command) {
|
|
61
64
|
case "add": return cmdAdd(rest, values);
|
|
62
65
|
case "list": return cmdList(rest[0], values);
|
|
66
|
+
case "copy-js": return cmdCopyJs(rest, values);
|
|
63
67
|
default: console.log(HELP);
|
|
64
68
|
}
|
|
65
69
|
}
|
package/dist/carousel.js
CHANGED
|
@@ -38,8 +38,17 @@ export function initCarousels(scope = document) {
|
|
|
38
38
|
scope.querySelectorAll(".oc-carousel--loop").forEach((root) => bindCarousel(root));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//
|
|
42
|
-
|
|
41
|
+
// Starts on its own when loaded straight from a <script type="module"> tag: as /js/oc-carousel.js (the docs site,
|
|
42
|
+
// `npx omniaui copy-js`), with ?auto in the URL, or with data-oc-auto on the tag. An import from a bundler or a
|
|
43
|
+
// wrapper does not scan the page: call the init function yourself there.
|
|
44
|
+
function autoStart() {
|
|
45
|
+
if (typeof document === "undefined") return false;
|
|
46
|
+
const url = String(import.meta.url);
|
|
47
|
+
if (url.includes("oc-carousel") || /[?&]auto(=|&|$)/.test(url)) return true;
|
|
48
|
+
const file = url.split(/[?#]/)[0];
|
|
49
|
+
return [...document.querySelectorAll("script[data-oc-auto][src]")].some((s) => s.src.split(/[?#]/)[0] === file);
|
|
50
|
+
}
|
|
51
|
+
if (autoStart()) {
|
|
43
52
|
const boot = () => initCarousels(document);
|
|
44
53
|
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
|
|
45
54
|
else boot();
|