@omnicajs/icons 0.3.0 → 0.3.2

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 (52) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +113 -0
  3. package/assets/icons/outlined/layout/sidebar-right.svg +3 -0
  4. package/assets/icons/outlined/layout/widget-bottom-right.svg +3 -0
  5. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  6. package/dist/build.js +1 -13
  7. package/dist/extracted/bundler/component-loader.cjs +26 -0
  8. package/dist/extracted/bundler/component-loader.d.ts +3 -0
  9. package/dist/extracted/bundler/plugin.cjs +125 -0
  10. package/dist/extracted/bundler/plugin.d.ts +21 -0
  11. package/dist/extracted/bundler/template-assets-loader.cjs +8 -0
  12. package/dist/extracted/bundler/template-assets-loader.d.ts +3 -0
  13. package/dist/extracted/core.d.ts +14 -0
  14. package/dist/extracted/core.js +64 -0
  15. package/dist/extracted/manifest.cjs +23 -0
  16. package/dist/extracted/manifest.d.ts +11 -0
  17. package/dist/extracted/manifest.js +20 -0
  18. package/dist/extracted/vite.d.ts +8 -0
  19. package/dist/extracted/vite.js +174 -0
  20. package/dist/manifest.cjs +1 -1
  21. package/dist/manifest.js +1 -1
  22. package/dist/manifest.json +21 -5
  23. package/dist/outlined/index.cjs +1 -1
  24. package/dist/outlined/index.d.ts +1 -1
  25. package/dist/outlined/index.js +1 -1
  26. package/dist/outlined/layout.cjs +1 -1
  27. package/dist/outlined/layout.d.ts +1 -1
  28. package/dist/outlined/layout.js +1 -1
  29. package/dist/rspack.cjs +14 -0
  30. package/dist/rspack.d.ts +16 -0
  31. package/dist/shared/sprite.d.ts +2 -0
  32. package/dist/shared/sprite.js +16 -0
  33. package/dist/sprites/outlined/layout.svg +6 -0
  34. package/dist/sprites/outlined.svg +6 -0
  35. package/dist/{adapter-output.d.ts → subset/adapter-output.d.ts} +1 -1
  36. package/dist/{adapter-output.js → subset/adapter-output.js} +1 -1
  37. package/dist/subset/vite.d.ts +7 -0
  38. package/dist/subset/vite.js +61 -0
  39. package/dist/{webpack-loader.cjs → subset/webpack-loader.cjs} +5 -9
  40. package/dist/{webpack-loader.d.ts → subset/webpack-loader.d.ts} +1 -1
  41. package/dist/{webpack-runtime.cjs → subset/webpack-runtime.cjs} +1 -1
  42. package/dist/subset/webpack.cjs +27 -0
  43. package/dist/subset/webpack.d.ts +14 -0
  44. package/dist/vite.d.ts +4 -7
  45. package/dist/vite.js +3 -61
  46. package/dist/webpack.cjs +9 -21
  47. package/dist/webpack.d.ts +12 -7
  48. package/metadata/icon-keywords.json +6 -0
  49. package/metadata/migrations/groups-v1.json +16 -0
  50. package/package.json +14 -2
  51. package/vue.d.ts +36 -0
  52. /package/dist/{webpack-runtime.d.ts → subset/webpack-runtime.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "variants": {
5
5
  "filled": {
6
6
  "sprite": "sprites/filled.svg",
@@ -8335,8 +8335,8 @@
8335
8335
  "outlined": {
8336
8336
  "sprite": "sprites/outlined.svg",
8337
8337
  "size": {
8338
- "bytes": 238777,
8339
- "gzipBytes": 72412
8338
+ "bytes": 239407,
8339
+ "gzipBytes": 72505
8340
8340
  },
8341
8341
  "groups": {
8342
8342
  "actions": {
@@ -9947,8 +9947,8 @@
9947
9947
  "layout": {
9948
9948
  "sprite": "sprites/outlined/layout.svg",
9949
9949
  "size": {
9950
- "bytes": 6461,
9951
- "gzipBytes": 1795
9950
+ "bytes": 7091,
9951
+ "gzipBytes": 1894
9952
9952
  },
9953
9953
  "icons": {
9954
9954
  "agenda-view": {
@@ -10037,6 +10037,22 @@
10037
10037
  "actions/pages-outlined"
10038
10038
  ]
10039
10039
  },
10040
+ "sidebar-right": {
10041
+ "source": "assets/icons/outlined/layout/sidebar-right.svg",
10042
+ "symbol": "layout/sidebar-right",
10043
+ "viewBox": "0 0 24 24",
10044
+ "keywords": [
10045
+ "media-n-editing/format_1_2"
10046
+ ]
10047
+ },
10048
+ "widget-bottom-right": {
10049
+ "source": "assets/icons/outlined/layout/widget-bottom-right.svg",
10050
+ "symbol": "layout/widget-bottom-right",
10051
+ "viewBox": "0 0 24 24",
10052
+ "keywords": [
10053
+ "media-n-editing/format_1_4"
10054
+ ]
10055
+ },
10040
10056
  "widget": {
10041
10057
  "source": "assets/icons/outlined/layout/widget.svg",
10042
10058
  "symbol": "layout/widget",
@@ -23,7 +23,7 @@ const iconNames = Object.freeze({
23
23
  "forms": Object.freeze(["category", "filter"]),
24
24
  "images": Object.freeze(["brightness-high", "brightness-low", "macro", "panorama-segmented", "panorama", "photo-gallery", "photo-landscape", "photo-square", "shutter"]),
25
25
  "keyboard": Object.freeze(["backspace"]),
26
- "layout": Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"]),
26
+ "layout": Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"]),
27
27
  "lifestyle": Object.freeze(["glasses", "shoe-print"]),
28
28
  "maps": Object.freeze(["location-marker-add", "location-marker-clear", "location-marker-remove", "location-marker", "map", "navigation", "pushpin"]),
29
29
  "media": Object.freeze(["eject-circle", "microphone-off", "microphone", "pause-circle", "play-circle", "play", "record", "slideshow", "stop-circle", "stop", "video-gallery", "video-horizontal", "video-vertical", "virtual-reality", "voice-input"]),
@@ -19,7 +19,7 @@ export declare const iconNames: {
19
19
  readonly "forms": readonly ["category", "filter"]
20
20
  readonly "images": readonly ["brightness-high", "brightness-low", "macro", "panorama-segmented", "panorama", "photo-gallery", "photo-landscape", "photo-square", "shutter"]
21
21
  readonly "keyboard": readonly ["backspace"]
22
- readonly "layout": readonly ["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"]
22
+ readonly "layout": readonly ["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"]
23
23
  readonly "lifestyle": readonly ["glasses", "shoe-print"]
24
24
  readonly "maps": readonly ["location-marker-add", "location-marker-clear", "location-marker-remove", "location-marker", "map", "navigation", "pushpin"]
25
25
  readonly "media": readonly ["eject-circle", "microphone-off", "microphone", "pause-circle", "play-circle", "play", "record", "slideshow", "stop-circle", "stop", "video-gallery", "video-horizontal", "video-vertical", "virtual-reality", "voice-input"]
@@ -21,7 +21,7 @@ export const iconNames = Object.freeze({
21
21
  "forms": Object.freeze(["category", "filter"]),
22
22
  "images": Object.freeze(["brightness-high", "brightness-low", "macro", "panorama-segmented", "panorama", "photo-gallery", "photo-landscape", "photo-square", "shutter"]),
23
23
  "keyboard": Object.freeze(["backspace"]),
24
- "layout": Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"]),
24
+ "layout": Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"]),
25
25
  "lifestyle": Object.freeze(["glasses", "shoe-print"]),
26
26
  "maps": Object.freeze(["location-marker-add", "location-marker-clear", "location-marker-remove", "location-marker", "map", "navigation", "pushpin"]),
27
27
  "media": Object.freeze(["eject-circle", "microphone-off", "microphone", "pause-circle", "play-circle", "play", "record", "slideshow", "stop-circle", "stop", "video-gallery", "video-horizontal", "video-vertical", "virtual-reality", "voice-input"]),
@@ -2,7 +2,7 @@ const { pathToFileURL } = require('node:url')
2
2
 
3
3
  const hasOwn = (object, key) => Object.prototype.hasOwnProperty.call(object, key)
4
4
 
5
- const iconNames = Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"])
5
+ const iconNames = Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"])
6
6
  const spriteUrl = new URL("../sprites/outlined/layout.svg", pathToFileURL(__filename)).href
7
7
 
8
8
  function iconUrl (name) {
@@ -1,4 +1,4 @@
1
- export declare const iconNames: readonly ["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"]
1
+ export declare const iconNames: readonly ["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"]
2
2
  export type IconName = typeof iconNames[number]
3
3
  export declare const spriteUrl: string
4
4
  export declare function iconUrl (name: IconName): string
@@ -1,6 +1,6 @@
1
1
  const hasOwn = (object, key) => Object.prototype.hasOwnProperty.call(object, key)
2
2
 
3
- export const iconNames = Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "widget"])
3
+ export const iconNames = Object.freeze(["agenda-view", "carousel-horizontal", "carousel-vertical", "column-view", "dashboard-split", "dashboard", "feed", "grid", "list", "pages", "sidebar-right", "widget-bottom-right", "widget"])
4
4
  export const spriteUrl = new URL("../sprites/outlined/layout.svg", import.meta.url).href
5
5
 
6
6
  export function iconUrl (name) {
@@ -0,0 +1,14 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_extracted_bundler_plugin = require("./extracted/bundler/plugin.cjs");
3
+ //#region tooling/rspack.ts
4
+ var OmnicaIconComponentsPlugin = class {
5
+ #plugin;
6
+ constructor(options = {}) {
7
+ this.#plugin = new require_extracted_bundler_plugin.BundlerIconComponentsPlugin(options);
8
+ }
9
+ apply(compiler) {
10
+ this.#plugin.apply(compiler);
11
+ }
12
+ };
13
+ //#endregion
14
+ exports.OmnicaIconComponentsPlugin = OmnicaIconComponentsPlugin;
@@ -0,0 +1,16 @@
1
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
2
+ export interface OmnicaIconComponentsPluginOptions {
3
+ /** Supports `[contenthash]` and `[contenthash:N]`. */
4
+ readonly filename?: string;
5
+ /** Overrides the loader used to compile the generated Vue SFC. */
6
+ readonly vueLoader?: string;
7
+ /** Client build output read by a later SSR build. Defaults to `<context>/dist`. */
8
+ readonly clientOutputDirectory?: string;
9
+ /** Overrides automatic Node-target SSR detection. */
10
+ readonly ssr?: boolean;
11
+ }
12
+ export declare class OmnicaIconComponentsPlugin implements RspackPluginInstance {
13
+ #private;
14
+ constructor(options?: OmnicaIconComponentsPluginOptions);
15
+ apply(compiler: Compiler): void;
16
+ }
@@ -0,0 +1,2 @@
1
+ export declare const serializeSprite: (symbols: readonly string[]) => string;
2
+ export declare const extractSymbol: (sprite: string, symbolId: string, filename: string) => string;
@@ -0,0 +1,16 @@
1
+ //#region tooling/shared/sprite.ts
2
+ var escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3
+ var serializeSprite = (symbols) => [
4
+ "<svg xmlns=\"http://www.w3.org/2000/svg\">",
5
+ symbols.join("\n"),
6
+ "</svg>",
7
+ ""
8
+ ].join("\n");
9
+ var extractSymbol = (sprite, symbolId, filename) => {
10
+ const expression = new RegExp(`<symbol\\b[^>]*\\bid=(["'])${escapeRegExp(symbolId)}\\1[\\s\\S]*?<\\/symbol>`);
11
+ const match = sprite.match(expression);
12
+ if (!match) throw new Error(`Unable to find symbol ${symbolId} in ${filename}`);
13
+ return match[0];
14
+ };
15
+ //#endregion
16
+ export { extractSymbol, serializeSprite };
@@ -28,6 +28,12 @@
28
28
  </symbol>
29
29
  <symbol id="layout/pages" viewBox="0 0 24 24">
30
30
  <path d="M15 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3ZM15 5V19H5V5H15ZM21 18V6C21 5.44772 20.5523 5 20 5H19V19H20C20.5523 19 21 18.5523 21 18Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
31
+ </symbol>
32
+ <symbol id="layout/sidebar-right" viewBox="0 0 24 24">
33
+ <path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3ZM19 5V19H16V5H19ZM14 5V19H5V5H14Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
34
+ </symbol>
35
+ <symbol id="layout/widget-bottom-right" viewBox="0 0 24 24">
36
+ <path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3ZM19 5V11H15C14.4477 11 14 11.4477 14 12V19H5V5H19ZM16 13H19V19H16V13Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
31
37
  </symbol>
32
38
  <symbol id="layout/widget" viewBox="0 0 24 24">
33
39
  <path d="M21 14V20C21 20.5523 20.5523 21 20 21H14C13.4477 21 13 20.5523 13 20V14C13 13.4477 13.4477 13 14 13H20C20.5523 13 21 13.4477 21 14ZM15 19H19V15H15V19ZM21 4L21 10C21 10.5523 20.5523 11 20 11L4 11C3.44772 11 3 10.5523 3 10L3 4C3 3.44772 3.44772 3 4 3L20 3C20.5523 3 21 3.44772 21 4ZM5 9L19 9L19 5L5 5V9ZM11 20V14C11 13.4477 10.5523 13 10 13H4C3.44772 13 3 13.4477 3 14V20C3 20.5523 3.44772 21 4 21L10 21C10.5523 21 11 20.5523 11 20ZM9 19H5V15H9V19Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
@@ -520,6 +520,12 @@
520
520
  </symbol>
521
521
  <symbol id="layout/pages" viewBox="0 0 24 24">
522
522
  <path d="M15 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3ZM15 5V19H5V5H15ZM21 18V6C21 5.44772 20.5523 5 20 5H19V19H20C20.5523 19 21 18.5523 21 18Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
523
+ </symbol>
524
+ <symbol id="layout/sidebar-right" viewBox="0 0 24 24">
525
+ <path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3ZM19 5V19H16V5H19ZM14 5V19H5V5H14Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
526
+ </symbol>
527
+ <symbol id="layout/widget-bottom-right" viewBox="0 0 24 24">
528
+ <path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3ZM19 5V11H15C14.4477 11 14 11.4477 14 12V19H5V5H19ZM16 13H19V19H16V13Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
523
529
  </symbol>
524
530
  <symbol id="layout/widget" viewBox="0 0 24 24">
525
531
  <path d="M21 14V20C21 20.5523 20.5523 21 20 21H14C13.4477 21 13 20.5523 13 20V14C13 13.4477 13.4477 13 14 13H20C20.5523 13 21 13.4477 21 14ZM15 19H19V15H15V19ZM21 4L21 10C21 10.5523 20.5523 11 20 11L4 11C3.44772 11 3 10.5523 3 10L3 4C3 3.44772 3.44772 3 4 3L20 3C20.5523 3 21 3.44772 21 4ZM5 9L19 9L19 5L5 5V9ZM11 20V14C11 13.4477 10.5523 13 10 13H4C3.44772 13 3 13.4477 3 14V20C3 20.5523 3.44772 21 4 21L10 21C10.5523 21 11 20.5523 11 20ZM9 19H5V15H9V19Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/>
@@ -1,4 +1,4 @@
1
- import type { IconBuildArtifact } from './build.js';
1
+ import type { IconBuildArtifact } from '../build.js';
2
2
  type ModuleFormat = 'esm' | 'cjs';
3
3
  export declare const createAdapterRuntime: (artifacts: readonly IconBuildArtifact[], spriteExpressions: Readonly<Record<string, string>>, format?: ModuleFormat) => string;
4
4
  export declare const createAdapterDeclarations: (artifacts: readonly IconBuildArtifact[], moduleId?: string) => string;
@@ -1,4 +1,4 @@
1
- //#region tooling/adapter-output.ts
1
+ //#region tooling/subset/adapter-output.ts
2
2
  var createAdapterRuntime = (artifacts, spriteExpressions, format = "esm") => {
3
3
  const declaration = format === "esm" ? "export " : "";
4
4
  return `const hasOwn = (object, key) => Object.prototype.hasOwnProperty.call(object, key)
@@ -0,0 +1,7 @@
1
+ import type { IconBuildConfig } from '../build.js';
2
+ import type { Plugin } from 'vite';
3
+ export interface OmnicaIconsOptions extends IconBuildConfig {
4
+ /** Writes exact declarations for `virtual:omnicajs-icons`. The file must be included by consumer TypeScript. */
5
+ readonly declarationFile?: string;
6
+ }
7
+ export declare const omnicaIcons: (options: OmnicaIconsOptions) => Plugin;
@@ -0,0 +1,61 @@
1
+ import { buildIconSet } from "../build.js";
2
+ import { createAdapterDeclarations, createAdapterRuntime } from "./adapter-output.js";
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import crypto from "node:crypto";
6
+ //#region tooling/subset/vite.ts
7
+ var virtualModuleId = "virtual:omnicajs-icons";
8
+ var resolvedVirtualModuleId = `\0${virtualModuleId}`;
9
+ var omnicaIcons = (options) => {
10
+ let artifacts = [];
11
+ let command = "build";
12
+ const references = {};
13
+ return {
14
+ name: "omnicajs-icons",
15
+ enforce: "pre",
16
+ configResolved(config) {
17
+ command = config.command;
18
+ },
19
+ async buildStart() {
20
+ artifacts = await buildIconSet(options);
21
+ if (options.declarationFile) {
22
+ const declarationFile = path.resolve(options.declarationFile);
23
+ await fs.mkdir(path.dirname(declarationFile), { recursive: true });
24
+ await fs.writeFile(declarationFile, createAdapterDeclarations(artifacts));
25
+ }
26
+ if (command === "build") for (const artifact of artifacts) references[artifact.variant] = this.emitFile({
27
+ type: "asset",
28
+ name: `omnica-icons-${artifact.variant}.svg`,
29
+ source: artifact.spriteSource
30
+ });
31
+ },
32
+ configureServer(server) {
33
+ server.middlewares.use("/@omnicajs/icons/", (request, response, next) => {
34
+ const variant = request.url?.split(/[?#]/, 1)[0]?.replace(/\.svg$/, "");
35
+ const artifact = artifacts.find((candidate) => candidate.variant === variant);
36
+ if (!artifact) {
37
+ next();
38
+ return;
39
+ }
40
+ response.statusCode = 200;
41
+ response.setHeader("Content-Type", "image/svg+xml");
42
+ response.setHeader("Cache-Control", "no-cache");
43
+ response.end(artifact.spriteSource);
44
+ });
45
+ },
46
+ resolveId(id) {
47
+ return id === virtualModuleId ? resolvedVirtualModuleId : null;
48
+ },
49
+ load(id) {
50
+ if (id !== resolvedVirtualModuleId) return null;
51
+ const spriteExpressions = Object.fromEntries(artifacts.map((artifact) => {
52
+ if (command === "build") return [artifact.variant, `import.meta.ROLLUP_FILE_URL_${references[artifact.variant]}`];
53
+ const hash = crypto.createHash("sha256").update(artifact.spriteSource).digest("hex").slice(0, 8);
54
+ return [artifact.variant, JSON.stringify(`/@omnicajs/icons/${artifact.variant}.svg?v=${hash}`)];
55
+ }));
56
+ return createAdapterRuntime(artifacts, spriteExpressions);
57
+ }
58
+ };
59
+ };
60
+ //#endregion
61
+ export { omnicaIcons };
@@ -1,21 +1,17 @@
1
+ const require_extracted_bundler_plugin = require("../extracted/bundler/plugin.cjs");
1
2
  let node_path = require("node:path");
2
- let node_crypto = require("node:crypto");
3
- let node_fs_promises = require("node:fs/promises");
4
3
  let node_url = require("node:url");
5
- //#region tooling/webpack-loader.ts
6
- var renderFilename = (template, variant, source) => {
7
- const hash = (0, node_crypto.createHash)("sha256").update(source).digest("hex");
8
- return template.replaceAll("[variant]", variant).replace(/\[contenthash(?::(\d+))?\]/g, (_match, length) => length ? hash.slice(0, Number(length)) : hash);
9
- };
4
+ let node_fs_promises = require("node:fs/promises");
5
+ //#region tooling/subset/webpack-loader.ts
10
6
  var omnicaIconsLoader = function() {
11
7
  const callback = this.async();
12
8
  const options = this.getOptions();
13
9
  this.cacheable(true);
14
- Promise.all([import((0, node_url.pathToFileURL)((0, node_path.join)(__dirname, "build.js")).href), import((0, node_url.pathToFileURL)((0, node_path.join)(__dirname, "adapter-output.js")).href)]).then(async ([{ buildIconSet }, { createAdapterDeclarations, createAdapterRuntime }]) => {
10
+ Promise.all([import((0, node_url.pathToFileURL)((0, node_path.join)(__dirname, "../build.js")).href), import((0, node_url.pathToFileURL)((0, node_path.join)(__dirname, "adapter-output.js")).href)]).then(async ([{ buildIconSet }, { createAdapterDeclarations, createAdapterRuntime }]) => {
15
11
  const artifacts = await buildIconSet(options.config);
16
12
  const spriteExpressions = {};
17
13
  for (const artifact of artifacts) {
18
- const filename = renderFilename(options.filename, artifact.variant, artifact.spriteSource);
14
+ const filename = require_extracted_bundler_plugin.renderContentHashFilename(options.filename.replaceAll("[variant]", artifact.variant), artifact.spriteSource);
19
15
  this.emitFile(filename, artifact.spriteSource);
20
16
  spriteExpressions[artifact.variant] = `(__webpack_public_path__ + ${JSON.stringify(filename)})`;
21
17
  }
@@ -1,4 +1,4 @@
1
- import type { IconBuildConfig } from './build.js';
1
+ import type { IconBuildConfig } from '../build.js';
2
2
  import type { LoaderDefinitionFunction } from 'webpack';
3
3
  interface OmnicaIconsLoaderOptions {
4
4
  readonly config: IconBuildConfig;
@@ -1,3 +1,3 @@
1
- //#region tooling/webpack-runtime.ts
1
+ //#region tooling/subset/webpack-runtime.ts
2
2
  throw new Error("virtual:omnicajs-icons requires OmnicaIconsPlugin in the Webpack configuration");
3
3
  //#endregion
@@ -0,0 +1,27 @@
1
+ let node_path = require("node:path");
2
+ //#region tooling/subset/webpack.ts
3
+ var virtualModuleId = "virtual:omnicajs-icons";
4
+ var OmnicaIconsPlugin = class {
5
+ #options;
6
+ constructor(options) {
7
+ this.#options = options;
8
+ }
9
+ apply(compiler) {
10
+ const runtimePath = (0, node_path.join)(__dirname, "webpack-runtime.cjs");
11
+ const loaderPath = (0, node_path.join)(__dirname, "webpack-loader.cjs");
12
+ new compiler.webpack.NormalModuleReplacementPlugin(new RegExp(`^${virtualModuleId}$`), runtimePath).apply(compiler);
13
+ compiler.options.module.rules.unshift({
14
+ include: runtimePath,
15
+ use: [{
16
+ loader: loaderPath,
17
+ options: {
18
+ config: this.#options,
19
+ declarationFile: this.#options.declarationFile,
20
+ filename: this.#options.filename ?? "icons/omnica-[variant].[contenthash:8].svg"
21
+ }
22
+ }]
23
+ });
24
+ }
25
+ };
26
+ //#endregion
27
+ exports.OmnicaIconsPlugin = OmnicaIconsPlugin;
@@ -0,0 +1,14 @@
1
+ import type { Compiler } from 'webpack';
2
+ import type { IconBuildConfig } from '../build.js';
3
+ import type { WebpackPluginInstance } from 'webpack';
4
+ export interface OmnicaIconsPluginOptions extends IconBuildConfig {
5
+ /** Writes exact declarations for `virtual:omnicajs-icons`. The file must be included by consumer TypeScript. */
6
+ readonly declarationFile?: string;
7
+ /** Supports `[variant]`, `[contenthash]`, and `[contenthash:N]`. */
8
+ readonly filename?: string;
9
+ }
10
+ export declare class OmnicaIconsPlugin implements WebpackPluginInstance {
11
+ #private;
12
+ constructor(options: OmnicaIconsPluginOptions);
13
+ apply(compiler: Compiler): void;
14
+ }
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- import type { IconBuildConfig } from './build.js';
2
- import type { Plugin } from 'vite';
3
- export interface OmnicaIconsOptions extends IconBuildConfig {
4
- /** Writes exact declarations for `virtual:omnicajs-icons`. The file must be included by consumer TypeScript. */
5
- readonly declarationFile?: string;
6
- }
7
- export declare const omnicaIcons: (options: OmnicaIconsOptions) => Plugin;
1
+ export type { OmnicaIconComponentsOptions } from './extracted/vite.js';
2
+ export type { OmnicaIconsOptions } from './subset/vite.js';
3
+ export { omnicaIconComponents } from './extracted/vite.js';
4
+ export { omnicaIcons } from './subset/vite.js';
package/dist/vite.js CHANGED
@@ -1,61 +1,3 @@
1
- import { createAdapterDeclarations, createAdapterRuntime } from "./adapter-output.js";
2
- import { buildIconSet } from "./build.js";
3
- import fs from "node:fs/promises";
4
- import path from "node:path";
5
- import crypto from "node:crypto";
6
- //#region tooling/vite.ts
7
- var virtualModuleId = "virtual:omnicajs-icons";
8
- var resolvedVirtualModuleId = `\0${virtualModuleId}`;
9
- var omnicaIcons = (options) => {
10
- let artifacts = [];
11
- let command = "build";
12
- const references = {};
13
- return {
14
- name: "omnicajs-icons",
15
- enforce: "pre",
16
- configResolved(config) {
17
- command = config.command;
18
- },
19
- async buildStart() {
20
- artifacts = await buildIconSet(options);
21
- if (options.declarationFile) {
22
- const declarationFile = path.resolve(options.declarationFile);
23
- await fs.mkdir(path.dirname(declarationFile), { recursive: true });
24
- await fs.writeFile(declarationFile, createAdapterDeclarations(artifacts));
25
- }
26
- if (command === "build") for (const artifact of artifacts) references[artifact.variant] = this.emitFile({
27
- type: "asset",
28
- name: `omnica-icons-${artifact.variant}.svg`,
29
- source: artifact.spriteSource
30
- });
31
- },
32
- configureServer(server) {
33
- server.middlewares.use("/@omnicajs/icons/", (request, response, next) => {
34
- const variant = request.url?.split(/[?#]/, 1)[0]?.replace(/\.svg$/, "");
35
- const artifact = artifacts.find((candidate) => candidate.variant === variant);
36
- if (!artifact) {
37
- next();
38
- return;
39
- }
40
- response.statusCode = 200;
41
- response.setHeader("Content-Type", "image/svg+xml");
42
- response.setHeader("Cache-Control", "no-cache");
43
- response.end(artifact.spriteSource);
44
- });
45
- },
46
- resolveId(id) {
47
- return id === virtualModuleId ? resolvedVirtualModuleId : null;
48
- },
49
- load(id) {
50
- if (id !== resolvedVirtualModuleId) return null;
51
- const spriteExpressions = Object.fromEntries(artifacts.map((artifact) => {
52
- if (command === "build") return [artifact.variant, `import.meta.ROLLUP_FILE_URL_${references[artifact.variant]}`];
53
- const hash = crypto.createHash("sha256").update(artifact.spriteSource).digest("hex").slice(0, 8);
54
- return [artifact.variant, JSON.stringify(`/@omnicajs/icons/${artifact.variant}.svg?v=${hash}`)];
55
- }));
56
- return createAdapterRuntime(artifacts, spriteExpressions);
57
- }
58
- };
59
- };
60
- //#endregion
61
- export { omnicaIcons };
1
+ import { omnicaIconComponents } from "./extracted/vite.js";
2
+ import { omnicaIcons } from "./subset/vite.js";
3
+ export { omnicaIconComponents, omnicaIcons };
package/dist/webpack.cjs CHANGED
@@ -1,28 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let node_path = require("node:path");
2
+ const require_extracted_bundler_plugin = require("./extracted/bundler/plugin.cjs");
3
+ const require_webpack = require("./subset/webpack.cjs");
3
4
  //#region tooling/webpack.ts
4
- var virtualModuleId = "virtual:omnicajs-icons";
5
- var OmnicaIconsPlugin = class {
6
- #options;
7
- constructor(options) {
8
- this.#options = options;
5
+ var OmnicaIconComponentsPlugin = class {
6
+ #plugin;
7
+ constructor(options = {}) {
8
+ this.#plugin = new require_extracted_bundler_plugin.BundlerIconComponentsPlugin(options);
9
9
  }
10
10
  apply(compiler) {
11
- const runtimePath = (0, node_path.join)(__dirname, "webpack-runtime.cjs");
12
- const loaderPath = (0, node_path.join)(__dirname, "webpack-loader.cjs");
13
- new compiler.webpack.NormalModuleReplacementPlugin(new RegExp(`^${virtualModuleId}$`), runtimePath).apply(compiler);
14
- compiler.options.module.rules.unshift({
15
- include: runtimePath,
16
- use: [{
17
- loader: loaderPath,
18
- options: {
19
- config: this.#options,
20
- declarationFile: this.#options.declarationFile,
21
- filename: this.#options.filename ?? "icons/omnica-[variant].[contenthash:8].svg"
22
- }
23
- }]
24
- });
11
+ this.#plugin.apply(compiler);
25
12
  }
26
13
  };
27
14
  //#endregion
28
- exports.OmnicaIconsPlugin = OmnicaIconsPlugin;
15
+ exports.OmnicaIconComponentsPlugin = OmnicaIconComponentsPlugin;
16
+ exports.OmnicaIconsPlugin = require_webpack.OmnicaIconsPlugin;
package/dist/webpack.d.ts CHANGED
@@ -1,14 +1,19 @@
1
1
  import type { Compiler } from 'webpack';
2
- import type { IconBuildConfig } from './build.js';
3
2
  import type { WebpackPluginInstance } from 'webpack';
4
- export interface OmnicaIconsPluginOptions extends IconBuildConfig {
5
- /** Writes exact declarations for `virtual:omnicajs-icons`. The file must be included by consumer TypeScript. */
6
- readonly declarationFile?: string;
7
- /** Supports `[variant]`, `[contenthash]`, and `[contenthash:N]`. */
3
+ export type { OmnicaIconsPluginOptions } from './subset/webpack.js';
4
+ export { OmnicaIconsPlugin } from './subset/webpack.js';
5
+ export interface OmnicaIconComponentsPluginOptions {
6
+ /** Supports `[contenthash]` and `[contenthash:N]`. */
8
7
  readonly filename?: string;
8
+ /** Overrides the loader used to compile the generated Vue SFC. */
9
+ readonly vueLoader?: string;
10
+ /** Client build output read by a later SSR build. Defaults to `<context>/dist`. */
11
+ readonly clientOutputDirectory?: string;
12
+ /** Overrides automatic Node-target SSR detection. */
13
+ readonly ssr?: boolean;
9
14
  }
10
- export declare class OmnicaIconsPlugin implements WebpackPluginInstance {
15
+ export declare class OmnicaIconComponentsPlugin implements WebpackPluginInstance {
11
16
  #private;
12
- constructor(options: OmnicaIconsPluginOptions);
17
+ constructor(options?: OmnicaIconComponentsPluginOptions);
13
18
  apply(compiler: Compiler): void;
14
19
  }
@@ -3747,9 +3747,15 @@
3747
3747
  "pages": [
3748
3748
  "actions/pages-outlined"
3749
3749
  ],
3750
+ "sidebar-right": [
3751
+ "media-n-editing/format_1_2"
3752
+ ],
3750
3753
  "widget": [
3751
3754
  "ui/widget_outlined",
3752
3755
  "ui/widget-outlined"
3756
+ ],
3757
+ "widget-bottom-right": [
3758
+ "media-n-editing/format_1_4"
3753
3759
  ]
3754
3760
  },
3755
3761
  "lifestyle": {
@@ -9878,5 +9878,21 @@
9878
9878
  "group": "people",
9879
9879
  "name": "users",
9880
9880
  "canonical": true
9881
+ },
9882
+ {
9883
+ "source": "assets/icons/media-n-editing/format_1_2.svg",
9884
+ "destination": "assets/icons/outlined/layout/sidebar-right.svg",
9885
+ "variant": "outlined",
9886
+ "group": "layout",
9887
+ "name": "sidebar-right",
9888
+ "canonical": true
9889
+ },
9890
+ {
9891
+ "source": "assets/icons/media-n-editing/format_1_4.svg",
9892
+ "destination": "assets/icons/outlined/layout/widget-bottom-right.svg",
9893
+ "variant": "outlined",
9894
+ "group": "layout",
9895
+ "name": "widget-bottom-right",
9896
+ "canonical": true
9881
9897
  }
9882
9898
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnicajs/icons",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "OmnicaJS icon set.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -77,6 +77,13 @@
77
77
  "types": "./dist/vite.d.ts",
78
78
  "import": "./dist/vite.js"
79
79
  },
80
+ "./vue": {
81
+ "types": "./vue.d.ts"
82
+ },
83
+ "./rspack": {
84
+ "types": "./dist/rspack.d.ts",
85
+ "require": "./dist/rspack.cjs"
86
+ },
80
87
  "./webpack": {
81
88
  "types": "./dist/webpack.d.ts",
82
89
  "require": "./dist/webpack.cjs"
@@ -89,6 +96,7 @@
89
96
  "assets",
90
97
  "dist",
91
98
  "metadata",
99
+ "/vue.d.ts",
92
100
  "CHANGELOG.md",
93
101
  "README.md",
94
102
  "LICENSE"
@@ -114,7 +122,7 @@
114
122
  "showcase:preview": "vitepress preview showcase --host 0.0.0.0",
115
123
  "test": "yarn build && yarn test:unit && yarn test:fixtures",
116
124
  "test:browser": "playwright test --config playwright.config.ts",
117
- "test:fixtures": "node dist/cli.js build --config fixtures/cli/omnica-icons.config.mjs && tsc --noEmit -p fixtures/cli/tsconfig.json && vite build --config fixtures/vite/vite.config.ts && tsc --noEmit -p fixtures/vite/tsconfig.json && webpack --config fixtures/webpack/webpack.config.cjs && tsc --noEmit -p fixtures/webpack/tsconfig.json",
125
+ "test:fixtures": "node dist/cli.js build --config fixtures/cli/omnica-icons.config.mjs && tsc --noEmit -p fixtures/cli/tsconfig.json && vite build --config fixtures/vite/vite.config.ts && node fixtures/vite/assert-formats.mjs && vite build --config fixtures/vite/vite.config.ts --base / --ssr src/ssr.ts --outDir dist-ssr && node fixtures/vite/assert-ssr.mjs && tsc --noEmit -p fixtures/vite/tsconfig.json && webpack --config fixtures/webpack/webpack.config.cjs && webpack --config fixtures/webpack/webpack.ssr.config.cjs && tsc --noEmit -p fixtures/webpack/tsconfig.json && rspack build --config fixtures/rspack/rspack.config.cjs && rspack build --config fixtures/rspack/rspack.ssr.config.cjs && tsc --noEmit -p fixtures/rspack/tsconfig.json && node fixtures/assert-bundler-ssr.mjs && node fixtures/assert-bundler-ssr-public-path.mjs && node fixtures/assert-bundler-watch.mjs",
118
126
  "test:unit": "node --test tests/*.test.ts",
119
127
  "typecheck": "tsc --noEmit && tsc --noEmit --project showcase/tsconfig.json"
120
128
  },
@@ -128,8 +136,11 @@
128
136
  "@modulify/conventional-release": "^0.1.3",
129
137
  "@omnicajs/eslint-plugin-dependencies": "^0.0.3",
130
138
  "@playwright/test": "^1.61.1",
139
+ "@rspack/cli": "^2.1.8",
140
+ "@rspack/core": "^2.1.8",
131
141
  "@stylistic/eslint-plugin": "^5.10.0",
132
142
  "@types/node": "^25.9.2",
143
+ "@vitejs/plugin-vue": "^6.0.8",
133
144
  "eslint": "^9.39.5",
134
145
  "eslint-plugin-vue": "^10.9.2",
135
146
  "globals": "^17.7.0",
@@ -143,6 +154,7 @@
143
154
  "vue": "^3.5.39",
144
155
  "vue-eslint-parser": "^10.4.1",
145
156
  "vue-i18n": "^11.4.6",
157
+ "vue-loader": "^17.4.2",
146
158
  "webpack": "^5.108.4",
147
159
  "webpack-cli": "^7.2.1",
148
160
  "yaml-eslint-parser": "^2.1.0"