@mrts/soltw 0.3.7 → 0.3.12
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/dist/_tw_styles.ts +76 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +3691 -0
- package/dist/index.jsx +3606 -0
- package/package.json +20 -15
- package/dist/cjs/index.js +0 -508
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/index.js +0 -495
- package/dist/esm/index.js.map +0 -1
- package/dist/source/Block.jsx +0 -25
- package/dist/source/index.js +0 -6
- package/dist/source/items/IdLabel.js +0 -15
- package/dist/source/items/Item.jsx +0 -89
- package/dist/source/items/ItemGroup.jsx +0 -62
- package/dist/source/soltw.jsx +0 -3
- package/dist/source/stylers/SVTStyler.js +0 -81
- package/dist/source/stylers/Stylers.js +0 -18
- package/dist/source/stylers/base.styler.js +0 -62
- package/dist/source/stylers/index.js +0 -5
- package/dist/source/stylers/normalizers.js +0 -59
- package/dist/source/stylers/types.js +0 -1
- package/dist/types/Block.d.ts +0 -10
- package/dist/types/index.d.ts +0 -6
- package/dist/types/items/IdLabel.d.ts +0 -12
- package/dist/types/items/Item.d.ts +0 -21
- package/dist/types/items/ItemGroup.d.ts +0 -21
- package/dist/types/soltw.d.ts +0 -4
- package/dist/types/stylers/SVTStyler.d.ts +0 -29
- package/dist/types/stylers/Stylers.d.ts +0 -8
- package/dist/types/stylers/base.styler.d.ts +0 -2
- package/dist/types/stylers/index.d.ts +0 -5
- package/dist/types/stylers/normalizers.d.ts +0 -3
- package/dist/types/stylers/types.d.ts +0 -10
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { createMemo, Show } from "solid-js";
|
|
2
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
-
import { Stylers } from "../stylers/Stylers.js";
|
|
4
|
-
import { buildIdLabel } from "./IdLabel.js";
|
|
5
|
-
export const Item = (props) => {
|
|
6
|
-
const itemData = () => buildIdLabel(props.idLabel);
|
|
7
|
-
const currentSTags = () => {
|
|
8
|
-
const r = [];
|
|
9
|
-
r.push("item");
|
|
10
|
-
if (props.selected) {
|
|
11
|
-
r.push("item:selected");
|
|
12
|
-
}
|
|
13
|
-
if (props.disabled) {
|
|
14
|
-
r.push("item:disabled");
|
|
15
|
-
}
|
|
16
|
-
return r;
|
|
17
|
-
};
|
|
18
|
-
const currentStyler = () => {
|
|
19
|
-
if (props.styler) {
|
|
20
|
-
return props.styler;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return Stylers.base;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const classProp = createMemo(() => {
|
|
27
|
-
if (props.class == undefined) {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
else if (typeof props.class == "string") {
|
|
31
|
-
return { item: props.class };
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return props.class;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const itemClasses = createMemo(() => {
|
|
38
|
-
const stags = currentSTags();
|
|
39
|
-
const styler = currentStyler();
|
|
40
|
-
const rawClasses = [];
|
|
41
|
-
const stylerClasses = styler
|
|
42
|
-
? styler.classes(stags, props.vtags)
|
|
43
|
-
: undefined;
|
|
44
|
-
rawClasses.push(...(stylerClasses ?? []));
|
|
45
|
-
if (props.callback) {
|
|
46
|
-
rawClasses.push("select-none cursor-pointer");
|
|
47
|
-
}
|
|
48
|
-
const customClasses = classProp();
|
|
49
|
-
if (customClasses.item) {
|
|
50
|
-
rawClasses.push(customClasses.item);
|
|
51
|
-
}
|
|
52
|
-
if (props.selected && customClasses.selected) {
|
|
53
|
-
rawClasses.push(customClasses.selected);
|
|
54
|
-
}
|
|
55
|
-
if (props.disabled && customClasses.disabled) {
|
|
56
|
-
rawClasses.push(customClasses.disabled);
|
|
57
|
-
}
|
|
58
|
-
rawClasses.push("relative");
|
|
59
|
-
const r = twMerge(rawClasses);
|
|
60
|
-
return r;
|
|
61
|
-
});
|
|
62
|
-
const disablerClasses = createMemo(() => {
|
|
63
|
-
const rawClasses = [];
|
|
64
|
-
if (currentStyler()) {
|
|
65
|
-
rawClasses.push(...currentStyler().classes("item/disabler", props.vtags));
|
|
66
|
-
}
|
|
67
|
-
if (classProp().disabler) {
|
|
68
|
-
rawClasses.push(classProp().disabler);
|
|
69
|
-
}
|
|
70
|
-
rawClasses.push("absolute inset-0");
|
|
71
|
-
const r = twMerge(rawClasses);
|
|
72
|
-
return r;
|
|
73
|
-
});
|
|
74
|
-
function handleClick() {
|
|
75
|
-
if (props.callback != undefined) {
|
|
76
|
-
props.callback(itemData());
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return (<div onClick={handleClick} class={itemClasses()}>
|
|
80
|
-
{itemData().label}
|
|
81
|
-
<Show when={props.disabled}>
|
|
82
|
-
<div class={disablerClasses()} onClick={(e) => {
|
|
83
|
-
if (!props.clickableWhendisabled) {
|
|
84
|
-
e.stopPropagation();
|
|
85
|
-
}
|
|
86
|
-
}}></div>
|
|
87
|
-
</Show>
|
|
88
|
-
</div>);
|
|
89
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { twMerge } from "tailwind-merge";
|
|
2
|
-
import { Block } from "../Block.jsx";
|
|
3
|
-
import { Item } from "./Item.js";
|
|
4
|
-
import { buildIdLabel } from "./IdLabel.js";
|
|
5
|
-
import { createMemo, For } from "solid-js";
|
|
6
|
-
import { argTokenizeBySpaces } from "../../../common/dist/strings/tokenize.js";
|
|
7
|
-
export const ItemGroup = (props) => {
|
|
8
|
-
const items = () => props.items.map(buildIdLabel);
|
|
9
|
-
const currentVTags = createMemo(() => {
|
|
10
|
-
const item = [];
|
|
11
|
-
const group = [];
|
|
12
|
-
const _vtags = props.vtags;
|
|
13
|
-
if (Array.isArray(_vtags) || typeof _vtags == "string") {
|
|
14
|
-
group.push(...argTokenizeBySpaces(_vtags));
|
|
15
|
-
}
|
|
16
|
-
else if (typeof _vtags == "object" && _vtags != null) {
|
|
17
|
-
group.push(...argTokenizeBySpaces(_vtags.group));
|
|
18
|
-
item.push(...argTokenizeBySpaces(_vtags.item));
|
|
19
|
-
}
|
|
20
|
-
return { group, item };
|
|
21
|
-
});
|
|
22
|
-
const classes = createMemo(() => {
|
|
23
|
-
let group = "";
|
|
24
|
-
let item = "";
|
|
25
|
-
if (typeof props.class == "string") {
|
|
26
|
-
group = props.class;
|
|
27
|
-
}
|
|
28
|
-
else if (props.class != undefined) {
|
|
29
|
-
props.class;
|
|
30
|
-
group = props.class.group ?? "";
|
|
31
|
-
item = props.class.item ?? "";
|
|
32
|
-
}
|
|
33
|
-
return { group, item };
|
|
34
|
-
});
|
|
35
|
-
const blockClasses = () => {
|
|
36
|
-
return twMerge("flex flex-row gap-1", classes().group);
|
|
37
|
-
};
|
|
38
|
-
const itemClasses = () => {
|
|
39
|
-
return classes().item;
|
|
40
|
-
};
|
|
41
|
-
const callCallback = (item) => {
|
|
42
|
-
if (props.callback) {
|
|
43
|
-
props.callback(item);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const itemSelected = (id) => {
|
|
47
|
-
if (typeof props.selection == "string") {
|
|
48
|
-
return id == props.selection;
|
|
49
|
-
}
|
|
50
|
-
else if (typeof props.selection == "object") {
|
|
51
|
-
return !!props.selection[id];
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
};
|
|
55
|
-
return (<Block class={blockClasses()} vtags={currentVTags().group}>
|
|
56
|
-
<For each={items()}>
|
|
57
|
-
{(item) => {
|
|
58
|
-
return (<Item idLabel={item} selected={itemSelected(item.id)} callback={() => callCallback(item)} class={itemClasses()} vtags={currentVTags().item}></Item>);
|
|
59
|
-
}}
|
|
60
|
-
</For>
|
|
61
|
-
</Block>);
|
|
62
|
-
};
|
package/dist/source/soltw.jsx
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { argTokenizeBySpaces, deduplicate } from "@mrts/common";
|
|
2
|
-
export class SVTStyler {
|
|
3
|
-
_rules = [];
|
|
4
|
-
options;
|
|
5
|
-
constructor(rules, options = {}) {
|
|
6
|
-
for (const r of rules) {
|
|
7
|
-
this._rules.push(SVTStyler.normalizeRule(r));
|
|
8
|
-
}
|
|
9
|
-
this.options = { ...options };
|
|
10
|
-
}
|
|
11
|
-
with(rules, options = {}) {
|
|
12
|
-
const addedRules = [];
|
|
13
|
-
for (const r of rules) {
|
|
14
|
-
addedRules.push(SVTStyler.normalizeRule(r));
|
|
15
|
-
}
|
|
16
|
-
const styler = new SVTStyler([], { ...this.options });
|
|
17
|
-
styler._rules.push(...this._rules, ...addedRules);
|
|
18
|
-
return styler;
|
|
19
|
-
}
|
|
20
|
-
classes(stags, vtags) {
|
|
21
|
-
const r = [];
|
|
22
|
-
let stagsNormalized = argTokenizeBySpaces(stags);
|
|
23
|
-
let vtagsNormalized = argTokenizeBySpaces(vtags);
|
|
24
|
-
if (this.options.stagsNormaliser) {
|
|
25
|
-
stagsNormalized = this.options.stagsNormaliser(stagsNormalized);
|
|
26
|
-
}
|
|
27
|
-
if (this.options.vtagsNormaliser) {
|
|
28
|
-
vtagsNormalized = this.options.vtagsNormaliser(vtagsNormalized);
|
|
29
|
-
}
|
|
30
|
-
for (const rule of this._rules) {
|
|
31
|
-
if (this.ruleMatches(rule, stagsNormalized, vtagsNormalized)) {
|
|
32
|
-
r.push(...rule.classes);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return this.options.normalizer ? this.options.normalizer(r) : r;
|
|
36
|
-
}
|
|
37
|
-
static normalizeRule(rule) {
|
|
38
|
-
let stagMode = rule.stagMode ?? "or";
|
|
39
|
-
let vtagMode = rule.vtagMode ?? "or";
|
|
40
|
-
let stags = deduplicate(argTokenizeBySpaces(rule.stags));
|
|
41
|
-
let vtags = deduplicate(argTokenizeBySpaces(rule.vtags));
|
|
42
|
-
let classes = deduplicate(argTokenizeBySpaces(rule.classes));
|
|
43
|
-
if (rule.stags == undefined && rule.stagMode == undefined) {
|
|
44
|
-
stagMode = "any";
|
|
45
|
-
}
|
|
46
|
-
if (rule.vtags == undefined && rule.vtagMode == undefined) {
|
|
47
|
-
vtagMode = "any";
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
stagRule: { mode: stagMode, tags: stags },
|
|
51
|
-
vtagRule: { mode: vtagMode, tags: vtags },
|
|
52
|
-
classes,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
ruleMatches(rule, stags, vtags) {
|
|
56
|
-
return (tagRuleMatches(rule.stagRule, stags) &&
|
|
57
|
-
tagRuleMatches(rule.vtagRule, vtags));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export function tagRuleMatches(rule, candidateTags) {
|
|
61
|
-
if (rule.mode == "any") {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
else if (rule.mode == "or") {
|
|
65
|
-
for (const ctag of candidateTags) {
|
|
66
|
-
if (rule.tags.indexOf(ctag) >= 0) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
else if (rule.mode == "and") {
|
|
73
|
-
for (const rtag of rule.tags) {
|
|
74
|
-
if (candidateTags.indexOf(rtag) < 0) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { baseStyler } from "./base.styler.js";
|
|
2
|
-
export class Stylers {
|
|
3
|
-
static _base;
|
|
4
|
-
static _stylersMap = new Map();
|
|
5
|
-
static get base() {
|
|
6
|
-
return this._base;
|
|
7
|
-
}
|
|
8
|
-
static setBase(base) {
|
|
9
|
-
return (this._base = base);
|
|
10
|
-
}
|
|
11
|
-
static {
|
|
12
|
-
this._stylersMap.set("default", baseStyler);
|
|
13
|
-
this.setBase(baseStyler);
|
|
14
|
-
}
|
|
15
|
-
static get(name) {
|
|
16
|
-
return this._stylersMap.get(name);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { mainTagNormalize, twMergeNormalize, exclusiveTagsNormalize, } from "./normalizers.js";
|
|
2
|
-
import { SVTStyler } from "./SVTStyler.js";
|
|
3
|
-
export const baseStyler = new SVTStyler([
|
|
4
|
-
{
|
|
5
|
-
vtags: "A",
|
|
6
|
-
classes: "bg-slate-100 text-slate-800",
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
vtags: "B",
|
|
10
|
-
classes: "bg-slate-800 text-slate-100",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
vtags: "C",
|
|
14
|
-
classes: "bg-stone-300 text-orange-950",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
vtags: "D",
|
|
18
|
-
classes: "bg-orange-900 text-stone-100",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
vtags: "LG",
|
|
22
|
-
classes: "text-xl p-2",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
vtags: "BASE",
|
|
26
|
-
classes: "text-base p-1",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
vtags: "SM",
|
|
30
|
-
classes: "text-sm p-0.5",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
vtags: "LG",
|
|
34
|
-
stags: "item",
|
|
35
|
-
classes: "text-xl px-2 py-1",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
vtags: "BASE",
|
|
39
|
-
stags: "item",
|
|
40
|
-
classes: "text-base px-1 py-0.5",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
vtags: "SM",
|
|
44
|
-
stags: "item",
|
|
45
|
-
classes: "text-sm p-0.5",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
stags: "item:selected",
|
|
49
|
-
classes: "underline font-bold",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
stags: "item:disabled",
|
|
53
|
-
classes: "blur-[1px]",
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
stags: "item/disabler",
|
|
57
|
-
classes: "bg-slate-300/85 cursor-not-allowed",
|
|
58
|
-
},
|
|
59
|
-
], {
|
|
60
|
-
normalizer: twMergeNormalize,
|
|
61
|
-
vtagsNormaliser: (tags) => exclusiveTagsNormalize(mainTagNormalize(tags, "A"), new Set(["SM", "BASE", "LG"]), "BASE"),
|
|
62
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { twMerge } from "tailwind-merge";
|
|
2
|
-
import { tokenizeFilterString } from "@mrts/common";
|
|
3
|
-
export function twMergeNormalize(raw) {
|
|
4
|
-
return tokenizeFilterString(twMerge(...raw));
|
|
5
|
-
}
|
|
6
|
-
export function mainTagNormalize(rawTags, defaultTag) {
|
|
7
|
-
return exclusiveTagsNormalize(rawTags, (tag) => tag.length == 1 && tag.toUpperCase() == tag, defaultTag);
|
|
8
|
-
}
|
|
9
|
-
// export function mainTagNormalize(
|
|
10
|
-
// rawTags: string[],
|
|
11
|
-
// defaultTag?: string
|
|
12
|
-
// ): string[] {
|
|
13
|
-
// const rhead = [] as string[];
|
|
14
|
-
// const rtail = [] as string[];
|
|
15
|
-
// let rtag: string | undefined = undefined;
|
|
16
|
-
// for (const tag of rawTags) {
|
|
17
|
-
// if (tag.length == 1 && tag.toUpperCase() == tag) {
|
|
18
|
-
// rtag = tag;
|
|
19
|
-
// rhead.push(...rtail);
|
|
20
|
-
// rtail.length = 0;
|
|
21
|
-
// } else {
|
|
22
|
-
// if (rtag == undefined) {
|
|
23
|
-
// rhead.push(tag);
|
|
24
|
-
// } else {
|
|
25
|
-
// rtail.push(tag);
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
// }
|
|
29
|
-
// rtag = rtag ?? defaultTag;
|
|
30
|
-
// const r =
|
|
31
|
-
// rtag == undefined ? [...rhead, ...rtail] : [...rhead, rtag, ...rtail];
|
|
32
|
-
// // console.log("MAIN TAGS NORM:", rawTags, r);
|
|
33
|
-
// return r;
|
|
34
|
-
// }
|
|
35
|
-
export function exclusiveTagsNormalize(rawTags, tagSet, defaultTag) {
|
|
36
|
-
const rhead = [];
|
|
37
|
-
const rtail = [];
|
|
38
|
-
let rtag = undefined;
|
|
39
|
-
const tagSetFunc = typeof tagSet == "function" ? tagSet : (tag) => tagSet.has(tag);
|
|
40
|
-
for (const tag of rawTags) {
|
|
41
|
-
if (tagSetFunc(tag)) {
|
|
42
|
-
rtag = tag;
|
|
43
|
-
rhead.push(...rtail);
|
|
44
|
-
rtail.length = 0;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
if (rtag == undefined) {
|
|
48
|
-
rhead.push(tag);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
rtail.push(tag);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
rtag = rtag ?? defaultTag;
|
|
56
|
-
const r = rtag == undefined ? [...rhead, ...rtail] : [...rhead, rtag, ...rtail];
|
|
57
|
-
//console.log("EXCLU TAGS NORM:", rawTags, r);
|
|
58
|
-
return r;
|
|
59
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/Block.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Component, ParentProps } from "solid-js";
|
|
2
|
-
import { type ISVTStyler, type TagListArgument } from "./stylers/index.js";
|
|
3
|
-
type TProps = ParentProps & {
|
|
4
|
-
vtags?: TagListArgument;
|
|
5
|
-
styler?: ISVTStyler;
|
|
6
|
-
class?: string;
|
|
7
|
-
element?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const Block: Component<TProps>;
|
|
10
|
-
export {};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface IdLabel {
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
[x: string | symbol]: unknown;
|
|
5
|
-
}
|
|
6
|
-
export type IdLabelDef = {
|
|
7
|
-
id: string;
|
|
8
|
-
label?: string;
|
|
9
|
-
[x: string | symbol]: unknown;
|
|
10
|
-
};
|
|
11
|
-
export type IdLabelArg = IdLabelDef | [string, string] | string;
|
|
12
|
-
export declare function buildIdLabel(arg: IdLabelArg): IdLabel;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type Component } from "solid-js";
|
|
2
|
-
import { type ISVTStyler, type TagListArgument } from "../stylers/index.js";
|
|
3
|
-
import { type IdLabel, type IdLabelArg } from "./IdLabel.js";
|
|
4
|
-
export type TItemClass = {
|
|
5
|
-
item?: string;
|
|
6
|
-
selected?: string;
|
|
7
|
-
disabled?: string;
|
|
8
|
-
disabler?: string;
|
|
9
|
-
};
|
|
10
|
-
export type TItemClassArg = TItemClass | string;
|
|
11
|
-
export type TItemProps = {
|
|
12
|
-
idLabel: IdLabelArg;
|
|
13
|
-
callback?: (item: IdLabel) => void;
|
|
14
|
-
selected?: boolean;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
clickableWhendisabled?: boolean;
|
|
17
|
-
styler?: ISVTStyler;
|
|
18
|
-
vtags?: TagListArgument;
|
|
19
|
-
class?: TItemClassArg;
|
|
20
|
-
};
|
|
21
|
-
export declare const Item: Component<TItemProps>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type TItemClassArg } from "./Item.js";
|
|
2
|
-
import { type IdLabel, type IdLabelArg } from "./IdLabel.js";
|
|
3
|
-
import { type Component } from "solid-js";
|
|
4
|
-
import { type TagListArgument } from "../stylers/types.js";
|
|
5
|
-
type TProps = {
|
|
6
|
-
items: IdLabelArg[];
|
|
7
|
-
callback?: (item: IdLabel) => void;
|
|
8
|
-
class?: string | {
|
|
9
|
-
group?: string;
|
|
10
|
-
item?: TItemClassArg;
|
|
11
|
-
};
|
|
12
|
-
selection?: string | {
|
|
13
|
-
[id: string]: boolean;
|
|
14
|
-
};
|
|
15
|
-
vtags?: TagListArgument | {
|
|
16
|
-
group?: TagListArgument;
|
|
17
|
-
item?: TagListArgument;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const ItemGroup: Component<TProps>;
|
|
21
|
-
export {};
|
package/dist/types/soltw.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ISVTStyler, TagListArgument, TagRule, TagRuleMode } from "./types.js";
|
|
2
|
-
export type SVTRule = {
|
|
3
|
-
stagRule: TagRule;
|
|
4
|
-
vtagRule: TagRule;
|
|
5
|
-
classes: string[];
|
|
6
|
-
};
|
|
7
|
-
export type SVTRuleDef = {
|
|
8
|
-
stagMode?: TagRuleMode;
|
|
9
|
-
vtagMode?: TagRuleMode;
|
|
10
|
-
stags?: TagListArgument;
|
|
11
|
-
vtags?: TagListArgument;
|
|
12
|
-
classes?: TagListArgument;
|
|
13
|
-
};
|
|
14
|
-
type SVTStylerOptions = {
|
|
15
|
-
normalizer?: (rawClasses: string[]) => string[];
|
|
16
|
-
stagsNormaliser?: (rawTags: string[]) => string[];
|
|
17
|
-
vtagsNormaliser?: (rawTags: string[]) => string[];
|
|
18
|
-
};
|
|
19
|
-
export declare class SVTStyler implements ISVTStyler {
|
|
20
|
-
readonly _rules: SVTRule[];
|
|
21
|
-
readonly options: SVTStylerOptions;
|
|
22
|
-
constructor(rules: SVTRuleDef[], options?: SVTStylerOptions);
|
|
23
|
-
with(rules: SVTRuleDef[], options?: SVTStylerOptions): SVTStyler;
|
|
24
|
-
classes(stags: TagListArgument, vtags: TagListArgument): string[];
|
|
25
|
-
static normalizeRule(rule: SVTRuleDef): SVTRule;
|
|
26
|
-
ruleMatches(rule: SVTRule, stags: string[], vtags: string[]): boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare function tagRuleMatches(rule: TagRule, candidateTags: string[]): boolean;
|
|
29
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ISVTStyler } from "./types.js";
|
|
2
|
-
export declare class Stylers {
|
|
3
|
-
private static _base;
|
|
4
|
-
private static _stylersMap;
|
|
5
|
-
static get base(): ISVTStyler | undefined;
|
|
6
|
-
static setBase(base: ISVTStyler | undefined): ISVTStyler;
|
|
7
|
-
static get(name: string): ISVTStyler | undefined;
|
|
8
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function twMergeNormalize(raw: string[]): string[];
|
|
2
|
-
export declare function mainTagNormalize(rawTags: string[], defaultTag?: string): string[];
|
|
3
|
-
export declare function exclusiveTagsNormalize(rawTags: string[], tagSet: Set<String> | ((tag: string) => boolean), defaultTag?: string): string[];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TokenizeArg } from "@mrts/common";
|
|
2
|
-
export type TagListArgument = TokenizeArg;
|
|
3
|
-
export interface ISVTStyler {
|
|
4
|
-
classes(stags: TagListArgument, vtags: TagListArgument): string[] | undefined;
|
|
5
|
-
}
|
|
6
|
-
export type TagRuleMode = "or" | "and" | "any";
|
|
7
|
-
export type TagRule = {
|
|
8
|
-
mode: TagRuleMode;
|
|
9
|
-
tags: string[];
|
|
10
|
-
};
|