@webx-ui/module-catalog-stock 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 webx-ui
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @webx-ui/module-catalog-stock
2
+
3
+ Stock statuses for the catalogue of the [WebX UI](https://github.com/webx-ui/webx-ui) admin panel:
4
+ in stock, out of stock, on order — one per product, and the status says whether it can be bought.
5
+
6
+ The other half is the Composer package `webx-ui/module-catalog-stock`, which owns the statuses, the
7
+ field of the product form, the column and the facet of the list, the bulk action «Set the stock
8
+ status» and the rule of `Purchasability`. The section appears in the panel when both halves are
9
+ installed, beside `@webx-ui/module-catalog`.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @webx-ui/module-catalog-stock
15
+ ```
16
+
17
+ ```ts
18
+ import { createAdmin } from '@webx-ui/module-admin'
19
+ import { catalog } from '@webx-ui/module-catalog'
20
+ import { catalogStock } from '@webx-ui/module-catalog-stock'
21
+ import '@webx-ui/module-catalog/style.css'
22
+ import '@webx-ui/module-catalog-stock/style.css'
23
+
24
+ createAdmin({
25
+ basePath: '/cms',
26
+ modules: [...catalog(), ...catalogStock()],
27
+ }).mount()
28
+ ```
29
+
30
+ `catalogStock()` is one section — the list of statuses, ordered by hand, and the page of one. It
31
+ stands in the «Catalog» group under «Dictionaries». The status field of the product form, the tag
32
+ in the list and the filter come through the catalogue's registries and need nothing here.
@@ -0,0 +1,2 @@
1
+ export { catalogStock, catalogStockOptions, type CatalogStockOptions } from './module';
2
+ export { catalogStockMessages } from './messages';
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import { dictionarySection as s, dictionaryOptions as a } from "@webx-ui/module-catalog";
2
+ const o = {
3
+ module: {
4
+ title: "Stock"
5
+ },
6
+ status: {
7
+ title: "Name",
8
+ code: "Code",
9
+ "code-help": "Latin letters, digits and hyphens: the status in the filter address (stock_in-stock) and in templates. Made from the name when left empty.",
10
+ color: "Tone",
11
+ "color-help": "The site paints the status line in this tone; the panel shows a tag of the same tone.",
12
+ tones: {
13
+ neutral: "Neutral",
14
+ primary: "Primary",
15
+ success: "Success",
16
+ warning: "Warning",
17
+ danger: "Danger",
18
+ info: "Info"
19
+ },
20
+ purchasable: "Can be bought",
21
+ "purchasable-help": "Off, a product in this status cannot be bought, and its name is what the site says instead of the buy button.",
22
+ default: "Default",
23
+ "default-help": "The status of every product nobody set a status for, and of a new product. To change it, make another status the default.",
24
+ filterable: "In the filter",
25
+ "filterable-help": "Off, the status is not a choice of the catalogue filter.",
26
+ new: "New status",
27
+ empty: "No stock statuses yet.",
28
+ "empty-help": "A status says whether a product is in stock and whether it can be bought.",
29
+ order: "The order here is the order of the filter",
30
+ hidden: "Not in the filter",
31
+ count: "Products: :count",
32
+ "show-items": "Show its products",
33
+ "delete-blocked": "While products are in it, it cannot go — move them to another status first.",
34
+ "delete-text": "It goes to the bin and leaves the filter.",
35
+ deleted: "The status is in the bin.",
36
+ saved: "The status is saved."
37
+ },
38
+ product: {
39
+ status: "Stock status",
40
+ "status-help": "Empty means the default status, whichever it is at the time.",
41
+ "status-empty": "Default status"
42
+ },
43
+ bulk: {
44
+ "set-stock": "Set the stock status"
45
+ }
46
+ }, e = {
47
+ id: "catalog-stock",
48
+ slug: "stock",
49
+ screen: "catalog.stock-status-form",
50
+ facet: "stock",
51
+ namespace: "webx-catalog-stock",
52
+ group: "status",
53
+ messages: o
54
+ };
55
+ function i(t = {}) {
56
+ return a({ ...e, catalog: t.path });
57
+ }
58
+ function c(t = {}) {
59
+ return [s({ ...e, catalog: t.path })];
60
+ }
61
+ export {
62
+ c as catalogStock,
63
+ o as catalogStockMessages,
64
+ i as catalogStockOptions
65
+ };
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/messages.ts","../src/module.ts"],"sourcesContent":["import type { Messages } from '@webx-ui/module-admin'\n\n/**\n * The English this package speaks on its own, before the server's dictionary arrives, or without\n * one. The server ships the same lines under `webx-catalog-stock::` and overrides these;\n * `messages.test.ts` keeps the two sets of keys equal.\n */\nexport const catalogStockMessages: Record<string, Messages> = {\n module: {\n title: 'Stock',\n },\n status: {\n title: 'Name',\n code: 'Code',\n 'code-help':\n 'Latin letters, digits and hyphens: the status in the filter address (stock_in-stock) and in templates. Made from the name when left empty.',\n color: 'Tone',\n 'color-help':\n 'The site paints the status line in this tone; the panel shows a tag of the same tone.',\n tones: {\n neutral: 'Neutral',\n primary: 'Primary',\n success: 'Success',\n warning: 'Warning',\n danger: 'Danger',\n info: 'Info',\n },\n purchasable: 'Can be bought',\n 'purchasable-help':\n 'Off, a product in this status cannot be bought, and its name is what the site says instead of the buy button.',\n default: 'Default',\n 'default-help':\n 'The status of every product nobody set a status for, and of a new product. To change it, make another status the default.',\n filterable: 'In the filter',\n 'filterable-help': 'Off, the status is not a choice of the catalogue filter.',\n new: 'New status',\n empty: 'No stock statuses yet.',\n 'empty-help': 'A status says whether a product is in stock and whether it can be bought.',\n order: 'The order here is the order of the filter',\n hidden: 'Not in the filter',\n count: 'Products: :count',\n 'show-items': 'Show its products',\n 'delete-blocked': 'While products are in it, it cannot go — move them to another status first.',\n 'delete-text': 'It goes to the bin and leaves the filter.',\n deleted: 'The status is in the bin.',\n saved: 'The status is saved.',\n },\n product: {\n status: 'Stock status',\n 'status-help': 'Empty means the default status, whichever it is at the time.',\n 'status-empty': 'Default status',\n },\n bulk: {\n 'set-stock': 'Set the stock status',\n },\n}\n","import type { AdminModule } from '@webx-ui/module-admin'\nimport {\n dictionaryOptions,\n dictionarySection,\n type DictionaryOptions,\n} from '@webx-ui/module-catalog'\nimport { catalogStockMessages } from './messages'\n\nexport interface CatalogStockOptions {\n /** Where the catalogue lives inside the panel — the same as `catalog({ path })`. */\n path?: string\n}\n\nconst STOCK: DictionaryOptions = {\n id: 'catalog-stock',\n slug: 'stock',\n screen: 'catalog.stock-status-form',\n facet: 'stock',\n namespace: 'webx-catalog-stock',\n group: 'status',\n messages: catalogStockMessages,\n}\n\n/** The stock statuses as the panel's shared category screens see them. */\nexport function catalogStockOptions(options: CatalogStockOptions = {}) {\n return dictionaryOptions({ ...STOCK, catalog: options.path })\n}\n\n/**\n * Stock statuses as a section of the panel (§2.2 of the dictionaries spec): in stock, out of\n * stock, on order — the list ordered by hand, which is the order of the filter, and the page of\n * one, which is the server's `catalog.stock-status-form`. Under «Dictionaries» of the «Catalog»\n * group, after the labels.\n *\n * The status of a product (`wx-select` over `catalog/stock`), its tag in the list, the filter and\n * «Set the stock status» all come through the catalogue's registries.\n */\nexport function catalogStock(options: CatalogStockOptions = {}): AdminModule[] {\n return [dictionarySection({ ...STOCK, catalog: options.path })]\n}\n"],"names":["catalogStockMessages","STOCK","catalogStockOptions","options","dictionaryOptions","catalogStock","dictionarySection"],"mappings":";AAOO,MAAMA,IAAiD;AAAA,EAC5D,QAAQ;AAAA,IACN,OAAO;AAAA,EAAA;AAAA,EAET,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aACE;AAAA,IACF,OAAO;AAAA,IACP,cACE;AAAA,IACF,OAAO;AAAA,MACL,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,IAER,aAAa;AAAA,IACb,oBACE;AAAA,IACF,SAAS;AAAA,IACT,gBACE;AAAA,IACF,YAAY;AAAA,IACZ,mBAAmB;AAAA,IACnB,KAAK;AAAA,IACL,OAAO;AAAA,IACP,cAAc;AAAA,IACd,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,cAAc;AAAA,IACd,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,SAAS;AAAA,IACT,OAAO;AAAA,EAAA;AAAA,EAET,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,gBAAgB;AAAA,EAAA;AAAA,EAElB,MAAM;AAAA,IACJ,aAAa;AAAA,EAAA;AAEjB,GC1CMC,IAA2B;AAAA,EAC/B,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAUD;AACZ;AAGO,SAASE,EAAoBC,IAA+B,IAAI;AACrE,SAAOC,EAAkB,EAAE,GAAGH,GAAO,SAASE,EAAQ,MAAM;AAC9D;AAWO,SAASE,EAAaF,IAA+B,IAAmB;AAC7E,SAAO,CAACG,EAAkB,EAAE,GAAGL,GAAO,SAASE,EAAQ,KAAA,CAAM,CAAC;AAChE;"}
@@ -0,0 +1,7 @@
1
+ import { Messages } from '@webx-ui/module-admin';
2
+ /**
3
+ * The English this package speaks on its own, before the server's dictionary arrives, or without
4
+ * one. The server ships the same lines under `webx-catalog-stock::` and overrides these;
5
+ * `messages.test.ts` keeps the two sets of keys equal.
6
+ */
7
+ export declare const catalogStockMessages: Record<string, Messages>;
@@ -0,0 +1,17 @@
1
+ import { AdminModule } from '@webx-ui/module-admin';
2
+ export interface CatalogStockOptions {
3
+ /** Where the catalogue lives inside the panel — the same as `catalog({ path })`. */
4
+ path?: string;
5
+ }
6
+ /** The stock statuses as the panel's shared category screens see them. */
7
+ export declare function catalogStockOptions(options?: CatalogStockOptions): import('@webx-ui/module-admin').CategoriesOptions;
8
+ /**
9
+ * Stock statuses as a section of the panel (§2.2 of the dictionaries spec): in stock, out of
10
+ * stock, on order — the list ordered by hand, which is the order of the filter, and the page of
11
+ * one, which is the server's `catalog.stock-status-form`. Under «Dictionaries» of the «Catalog»
12
+ * group, after the labels.
13
+ *
14
+ * The status of a product (`wx-select` over `catalog/stock`), its tag in the list, the filter and
15
+ * «Set the stock status» all come through the catalogue's registries.
16
+ */
17
+ export declare function catalogStock(options?: CatalogStockOptions): AdminModule[];
package/dist/style.css ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@webx-ui/module-catalog-stock",
3
+ "version": "0.1.0",
4
+ "description": "Stock statuses for the catalogue of the WebX UI admin panel: in stock, out of stock, on order — a reference book, a field of the product form, a column and a filter of the list.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": [
8
+ "*.css"
9
+ ],
10
+ "keywords": [
11
+ "webx-ui",
12
+ "vue",
13
+ "admin",
14
+ "cms",
15
+ "catalog",
16
+ "e-commerce",
17
+ "stock",
18
+ "availability"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/webx-ui/webx-ui.git",
23
+ "directory": "packages/module-catalog-stock"
24
+ },
25
+ "homepage": "https://github.com/webx-ui/webx-ui/tree/main/packages/module-catalog-stock",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js"
39
+ },
40
+ "./style.css": "./dist/style.css",
41
+ "./dist/style.css": "./dist/style.css",
42
+ "./package.json": "./package.json"
43
+ },
44
+ "peerDependencies": {
45
+ "vue": "^3.5.0",
46
+ "vue-router": "^4.5.0"
47
+ },
48
+ "dependencies": {
49
+ "@webx-ui/core": "^0.34.2",
50
+ "@webx-ui/module-admin": "^0.21.0",
51
+ "@webx-ui/module-catalog": "^0.4.0",
52
+ "@webx-ui/schema": "^0.6.4"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^24.10.1",
56
+ "@vitejs/plugin-vue": "^6.0.1",
57
+ "typescript": "^5.9.3",
58
+ "vite": "^7.1.14",
59
+ "vite-plugin-dts": "^4.5.4",
60
+ "vue": "^3.5.24",
61
+ "vue-router": "^4.5.1",
62
+ "vue-tsc": "^3.1.3"
63
+ },
64
+ "scripts": {
65
+ "build": "vite build",
66
+ "dev": "vite build --watch",
67
+ "typecheck": "vue-tsc -p tsconfig.json --noEmit"
68
+ }
69
+ }