@porbit/style weekly downloads statistics
By porbit · npm · Webpack plugins
PresenceStyle: utility CSS engine mở — parse class runtime, sinh CSS theo layer/media, trích xuất CSS tĩnh, bộ component mẫu và MCP server cho agent AI.
@porbit/style has 42 recorded weekly downloads on npm, a decrease of 82.1% over the past 30 days, ranking #2817 of 3,247 tracked listings.
About @porbit/style
PresenceStyle (@porbit/style)
Tiếng Việt · English
@porbit/style là utility CSS engine siêu nhẹ, parse class theo cú pháp ngắn và sinh CSS runtime theo layer + media. Đây là công thức tổng quát, không phải bộ class đóng: bảng alias chỉ là lối tắt, còn mọi property và giá trị CSS đều viết được (xem Từ vựng mở). Người dùng Tailwind có thể chuyển sang bằng helper migration.
Cài Đặt Nhanh
1) NPM / pnpm / yarn / bun
npm install @porbit/style
pnpm add @porbit/style
yarn add @porbit/style
bun add @porbit/style
Yêu cầu Node.js 20 trở lên cho CLI, SSR và MCP server. Package không có dependency runtime.
2) Dùng trực tiếp qua URL (không cần bundler)
Lưu ý:
dist/index.jslà CommonJS (Node).- Trình duyệt dùng
dist/index.mjshoặcdist/index-auto.mjs.
Option A: chủ động khởi tạo
<script type="module">
import xcss from 'https://unpkg.com/@porbit/style@latest/dist/index.mjs';
xcss.cssObserve(document, {
dictionaryImport: true
});
</script>
Option B: auto observe khi import (bản nhẹ nhất: chỉ lõi runtime, không gồm Tailwind helper)
<script type="module" src="https://unpkg.com/@porbit/style@latest/dist/index-auto.mjs"></script>
CDN thay thế:
https://cdn.jsdelivr.net/npm/@porbit/style@latest/dist/index.mjs
Dùng Trong 60 Giây
import xcss from '@porbit/style';
xcss.cssObserve(document);
<button class="dF aiC jcC p10px;16px bdN bdra8px bgc#0a64e8 cWhite">
Đăng nhập
</button>
Muốn dựng giao diện từ đầu (thẻ đăng nhập, lưới responsive, bảng tra alias, lỗi thường gặp), xem Hướng dẫn thiết kế nhanh. Muốn biết cách viết bất kỳ CSS nào (property chưa có alias, custom property, hàm CSS, điều kiện, media), xem Từ vựng mở.
Contract Cú Pháp
Mỗi utility class theo form:
[Media]:[Layer][Property][Value][@Selector]
Thứ tự parse bắt buộc:
selector(hậu tố@..., nằm ngoài[]).media(tiền tố trước:).layer(chuỗi số liên tiếp ở đầu).property.value.
Ý nghĩa từng phần:
Media(tùy chọn): key media nhưsm,md,lg, hoặc key custom.Layer(tùy chọn): số ưu tiên cascade.Property(bắt buộc): alias thuộc dictionary, hoặc tên CSS đầy đủ của bất kỳ property chuẩn nào (view-transition-name[hero]), custom property--ten[gia-tri], hoặc property có tiền tố nhà cung cấp (-webkit-line-clamp[3]). Xem Từ vựng mở.Value(bắt buộc với utility chuẩn): giá trị CSS, alias value hoặc arbitrary value.@Selector(tùy chọn): ví dụ@:hover,@::before.
Ngoại lệ parser (special syntax):
[AliasName]: class group alias (không dùng value trực tiếp).&...: nhánh selector đặc biệt.
Media Mặc Định Và Thứ Tự Nội Bộ
Engine nạp media theo thứ tự:
| Thứ tự | Key | Query |
|---|---|---|
| 1 | default | Không bọc @media |
| 2 | xs | screen and (max-width: 575px) |
| 3 | sm | screen and (min-width: 576px) |
| 4 | md | screen and (min-width: 768px) |
| 5 | lg | screen and (min-width: 992px) |
| 6 | xl | screen and (min-width: 1200px) |
| 7 | 2xl | screen and (min-width: 1400px) |
| 8 | sma | screen and (max-width: 768px) |
| 9 | mda | screen and (max-width: 992px) |
| 10 | lga | screen and (max-width: 1200px) |
| 11 | xla | screen and (max-width: 1400px) |
Quy tắc custom breakpoint:
breakpointsđược nối vào sau danh sách mặc định.- Nếu trùng key, key khai báo sau cùng ghi đè key trước (
last write wins).
Ví dụ:
xcss.cssObserve(document, {
breakpoints: [
{ tablet: 'screen and (min-width: 768px)' }
]
});
Dùng class: tablet:dB.
Layer Mặc Định
- Nếu không khai báo layer, engine dùng
0. - Engine tạo sẵn 24 layer:
l0 -> l23. - Nên dùng dải
0-23để giữ thứ tự ổn định. - Số layer lớn hơn luôn thắng số nhỏ hơn, kể cả khi class layer nhỏ nằm trong media đang khớp (ví dụ
5cBluethắngmd:cRedở màn hìnhmd; muốn ghi đè theo breakpoint hãy dùngmd:5cRed).
Quy Tắc Điểm Ngắt Đầy Đủ
Mục tiêu là tách class thành tuple:
{ media, layer, property, value, selector }
Thứ tự xử lý bắt buộc:
- Tách
selector: lấy phần sau ký tự@cuối cùng, chỉ khi@nằm ngoài[]. - Tách
media: nếu còn:thì phần trước:làmedia. - Tách
layer: đọc chuỗi số liên tiếp ở đầu phần còn lại. - Tách
property/value: quét trái -> phải và dừngpropertytheo bảng quyết định. - Nếu phần còn lại bắt đầu bằng
&hoặc[thì đi vào nhánh special syntax.
Bảng Quyết Định Khi Quét property
| Ký tự đang xét | Điều kiện | Hành động |
|---|---|---|
a-z | luôn đúng | vẫn là property |
- hoặc . | ký tự kế tiếp là số | dừng property, phần còn lại là value |
- | gặp -- và đã có ít nhất 1 ký tự property | dừng property, bắt đầu value (CSS variable) |
- hoặc . | không rơi vào 2 điều kiện trên | vẫn là property |
ký tự khác (A-Z, 0-9, #, !, [, (, %, ...) | luôn đúng | dừng property, phần còn lại là value |
Chuẩn Hóa value Sau Khi Tách
- Value bắt đầu bằng
!-> thêm hậu tố!important. - Value bắt đầu bằng
---> đổi thànhvar(--...). - Value dạng
[...]-> bỏ[], rồi thay_và;thành khoảng trắng (\_giữ dấu gạch dưới; nội dungurl(...)giữ nguyên). - Ký tự
#trong value giữ nguyên (hex color).
Quy trình chuẩn hóa:
class -> selector -> media -> layer -> property -> value
if value startsWith('!') => important
if value startsWith('--') => var(value)
if value is bracketed [..] => strip brackets + replace ';' with ' '
Bảng Sai -> Đúng (Những Lỗi Gây Vỡ Parse)…
Description from the npm listing.
- presence
- presence-style
- porbit
- css
- css-in-js
- utility
- atomic-css
- utility-first
- static-extraction
- ssr
- typescript
- x-css
- components
- design-system
- mcp
- model-context-protocol
- vite-plugin
- webpack-plugin
- nextjs
- tailwindcss
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (135)Similar npm Webpack plugins plugins
All 20 @porbit/style alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@porbit/style. First seen Nov 17, 2026; last successful collection Dec 6, 2026. See the methodology.