unicode-input-toolconverter 0.2.0 → 0.2.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/.nyc_output/out.json +8980 -1849
- package/CHANGES.md +15 -1
- package/README.md +6 -11
- package/_locales/en-US/messages.json +153 -6
- package/_locales/hu-HU/messages.json +153 -6
- package/_locales/pt-BR/messages.json +153 -6
- package/_locales/sv-SE/messages.json +153 -6
- package/babel.config.json +0 -1
- package/browser_action/characterSelection.js +18 -11
- package/browser_action/charrefConverters.js +286 -79
- package/browser_action/chartBuild.js +97 -27
- package/browser_action/encodingBehaviors.js +10 -7
- package/browser_action/entityBehaviors.js +42 -16
- package/browser_action/index-es.html +13 -1
- package/browser_action/index-instrumented.html +13 -1
- package/browser_action/index-pages.html +13 -1
- package/browser_action/index.html +13 -1
- package/browser_action/index.iife.min.js +9 -1
- package/browser_action/index.iife.min.js.map +1 -1
- package/browser_action/index.instrumented.iife.min.js +1 -1
- package/browser_action/index.instrumented.iife.min.js.map +1 -1
- package/browser_action/index.js +5 -5
- package/browser_action/preferences/prefDefaults.js +12 -3
- package/browser_action/service-worker/sw-activateCallback.js +1 -2
- package/browser_action/service-worker/sw-resources.json +6 -4
- package/browser_action/templateUtils/elements.js +12 -1
- package/browser_action/templateUtils/fill.js +6 -0
- package/browser_action/templateUtils/validation.js +4 -1
- package/browser_action/templates/chartBuild.js +167 -102
- package/browser_action/templates/index.js +227 -53
- package/browser_action/templatesElementCustomization/widgets.js +40 -15
- package/browser_action/unicode/UnicodeConverter.js +99 -73
- package/browser_action/unicode/charrefunicodeDb.js +100 -50
- package/browser_action/unicode/getScriptInfoForCodePoint.js +13 -4
- package/browser_action/unicode/hangul.js +27 -20
- package/browser_action/unicode/lastScriptNames.json +1 -1
- package/browser_action/unicode/parseUnihanFromTextFileStrings.js +44 -25
- package/browser_action/unicode/unicodeFieldInfo.js +112 -90
- package/browser_action/unicode/unicodeScripts.js +409 -35
- package/browser_action/unicode/unihan.js +4 -3
- package/browser_action/unicode/unihanDbPopulate.js +7 -2
- package/browser_action/unicode/unihanFields.js +34 -0
- package/browser_action/unicodecharref.js +353 -190
- package/browser_action/utils/DOMUtils.js +95 -34
- package/browser_action/utils/FetchUtils.js +7 -6
- package/browser_action/utils/TextUtils.js +4 -4
- package/browser_action/utils/TypedArrayUtils.js +9 -5
- package/browser_action/utils/semicolonSeparatedToArray.js +3 -3
- package/browser_action/utils/setupServiceWorker.js +2 -2
- package/eslint.config.js +11 -0
- package/icons/openWindow16.png +0 -0
- package/icons/openWindow24.png +0 -0
- package/lib/background.html +7 -0
- package/lib/background.js +2 -2
- package/package.json +80 -70
- package/pnpm-workspace.yaml +8 -0
- package/server.js +66 -51
- package/sw.js +97 -56
- package/tools/entities-import.js +4 -1
- package/tools/findEsResources.js +33 -10
- package/tools/fix-sw-resources-vendor-paths.js +60 -0
- package/tools/list-locales.js +2 -2
- package/tools/parseUnicodeCharts.js +126 -60
- package/tools/ucd-import.js +1 -10
- package/tools/unicode-charts.html +49 -20
- package/tools/unihan-import.js +45 -15
- package/tools/write-sw-version.js +16 -0
- package/tsconfig.json +23 -0
- package/typings/__coverage__.d.ts +5 -0
- package/typings/apple-system-profiler.d.ts +17 -0
- package/typings/commands.d.ts +19 -0
- package/typings/json-6.d.ts +4 -0
- package/typings/rollup-plugin-istanbul.d.ts +3 -0
- package/vendor/camelcase/index.d.ts +154 -0
- package/vendor/camelcase/index.js +137 -23
- package/vendor/fflate/esm/browser.d.ts +1539 -0
- package/vendor/fflate/esm/browser.js +82 -55
- package/vendor/intl-dom/dist/Formatter.d.ts +120 -0
- package/vendor/intl-dom/dist/Formatter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/collation.d.ts +42 -0
- package/vendor/intl-dom/dist/collation.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts +52 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts +96 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts +17 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts +285 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts.map +1 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts +88 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts +67 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts +73 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts +26 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts.map +1 -0
- package/vendor/intl-dom/dist/i18n.d.ts +113 -0
- package/vendor/intl-dom/dist/i18n.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.d.ts +92 -0
- package/vendor/intl-dom/dist/index.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.esm.d.ts +34 -0
- package/vendor/intl-dom/dist/index.esm.js +854 -896
- package/vendor/intl-dom/dist/index.esm.min.js +4 -0
- package/vendor/intl-dom/dist/index.esm.min.js.map +1 -0
- package/vendor/intl-dom/dist/index.umd.js +2953 -0
- package/vendor/intl-dom/dist/index.umd.min.js +4 -0
- package/vendor/intl-dom/dist/index.umd.min.js.map +1 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts +34 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts.map +1 -0
- package/vendor/intl-dom/dist/shared.d.ts +20 -0
- package/vendor/intl-dom/dist/shared.d.ts.map +1 -0
- package/vendor/intl-dom/dist/utils.d.ts +53 -0
- package/vendor/intl-dom/dist/utils.d.ts.map +1 -0
- package/vendor/jamilih/dist/jml.d.mts +468 -0
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +1489 -343
- package/vendor/jquery/dist/jquery.js +1677 -2713
- package/vendor/json-6/dist/index.mjs +2 -0
- package/vendor/miller-columns/CHANGES.md +185 -0
- package/vendor/miller-columns/LICENSE-MIT.txt +21 -0
- package/vendor/miller-columns/README.md +249 -0
- package/vendor/miller-columns/demos/index.html +69 -0
- package/vendor/miller-columns/demos/index.js +72 -0
- package/vendor/miller-columns/dist/index-es.js +748 -0
- package/vendor/miller-columns/dist/index-es.min.d.ts +25 -0
- package/vendor/miller-columns/dist/index-es.min.js +7 -1
- package/vendor/miller-columns/dist/index-umd.js +757 -0
- package/vendor/miller-columns/dist/index-umd.min.js +7 -0
- package/vendor/miller-columns/dist/index.d.ts +25 -0
- package/vendor/miller-columns/dist/millerColumns.d.ts +10 -0
- package/vendor/miller-columns/eslint.config.js +46 -0
- package/vendor/miller-columns/fix-declarations.js +18 -0
- package/vendor/miller-columns/miller-columns.css +24 -1
- package/vendor/miller-columns/package.json +73 -0
- package/vendor/miller-columns/pnpm-workspace.yaml +2 -0
- package/vendor/miller-columns/src/index.js +642 -0
- package/vendor/miller-columns/src/millerColumns.ts +12 -0
- package/vendor/miller-columns/tsconfig-prod.json +23 -0
- package/vendor/miller-columns/tsconfig.json +21 -0
- package/vendor/simple-prefs/dist/index.esm.d.ts +1 -0
- package/vendor/simple-prefs/dist/index.esm.js +164 -216
- package/vendor/simple-prefs/dist/simple-prefs.d.ts +117 -0
- package/lgtm.yml +0 -5
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/// <reference path="./jamilih-dialect.d.ts" />
|
|
2
|
+
import { validateJamilih } from './validateJamilih.js';
|
|
3
|
+
export type HTMLWindow = Window & {
|
|
4
|
+
DocumentFragment: typeof DocumentFragment;
|
|
5
|
+
};
|
|
6
|
+
export type ArbitraryValue = unknown;
|
|
7
|
+
export type StoredValue = unknown;
|
|
8
|
+
export type UserArg = any;
|
|
9
|
+
export type ElementExpando = any;
|
|
10
|
+
export type ExpandoHTMLElement = HTMLElement & {
|
|
11
|
+
[key: string]: ElementExpando;
|
|
12
|
+
};
|
|
13
|
+
export type Integer = number;
|
|
14
|
+
export type PluginSettings = {
|
|
15
|
+
element: Document | HTMLElement | DocumentFragment;
|
|
16
|
+
attribute: {
|
|
17
|
+
name: string | null;
|
|
18
|
+
value: JamilihAttValue;
|
|
19
|
+
};
|
|
20
|
+
opts: JamilihOptions;
|
|
21
|
+
};
|
|
22
|
+
export type JamilihPlugin = {
|
|
23
|
+
name: string;
|
|
24
|
+
set: (opts: PluginSettings) => string | Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} sel
|
|
28
|
+
* @returns {HTMLElement|null}
|
|
29
|
+
*/
|
|
30
|
+
declare const $: (sel: string) => HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} sel
|
|
33
|
+
* @returns {HTMLElement[]}
|
|
34
|
+
*/
|
|
35
|
+
declare const $$: (sel: string) => HTMLElement[];
|
|
36
|
+
export type ChildrenToJMLCallback = (childNodeJML: JamilihArray | JamilihChildType | string, i: Integer) => void;
|
|
37
|
+
export type JamilihDialectObject = [keyof JamilihDialectProperties] extends [never] ? never : Partial<JamilihDialectProperties>;
|
|
38
|
+
export type JamilihFirstArg = JamilihDoc | JamilihDoctype | JamilihTextNode | JamilihAttributeNode | JamilihOptions | JamilihDialectObject | ElementName | HTMLElement | JamilihDocumentFragment;
|
|
39
|
+
export type JamilihAppender = (childJML: JamilihArray | JamilihArrayLike | JamilihFirstArg | Node | TextNodeString) => void;
|
|
40
|
+
export type appender = (childJML: JamilihArray | JamilihArrayLike | JamilihFirstArg | Node | TextNodeString) => void;
|
|
41
|
+
export type JamilihReturn = HTMLElement | DocumentFragment | Comment | Attr | Text | Document | DocumentType | ProcessingInstruction | CDATASection;
|
|
42
|
+
export type TemplateJamilihArray = [(JamilihAttributes | JamilihArray | JamilihArray[] | HTMLElement), ...(JamilihArray | JamilihArray[] | HTMLElement)[]];
|
|
43
|
+
export type ShadowRootJamilihArrayContainer = (JamilihArray | HTMLElement)[];
|
|
44
|
+
export type JamilihShadowRootObject = {
|
|
45
|
+
open?: boolean | ShadowRootJamilihArrayContainer;
|
|
46
|
+
closed?: boolean | ShadowRootJamilihArrayContainer;
|
|
47
|
+
template?: string | HTMLTemplateElement | TemplateJamilihArray;
|
|
48
|
+
content?: ShadowRootJamilihArrayContainer | DocumentFragment;
|
|
49
|
+
};
|
|
50
|
+
export type XmlnsAttributeObject = {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
};
|
|
53
|
+
export type XmlnsAttributeValue = null | XmlnsAttributeObject;
|
|
54
|
+
export type DatasetAttributeObject = {
|
|
55
|
+
[key: string]: string | number | null | undefined | DatasetAttributeObject;
|
|
56
|
+
};
|
|
57
|
+
export type StyleAttributeValue = string | undefined | {
|
|
58
|
+
[key: string]: string | null;
|
|
59
|
+
};
|
|
60
|
+
export type EventHandler<T extends HTMLElement = HTMLElement> = (this: T, event: Event & {
|
|
61
|
+
target: T;
|
|
62
|
+
}) => void;
|
|
63
|
+
export type OnAttributeObject<T extends HTMLElement = HTMLElement> = {
|
|
64
|
+
[key: string]: EventHandler<T> | [EventHandler<T>, boolean];
|
|
65
|
+
};
|
|
66
|
+
export type OnAttribute<T extends HTMLElement = HTMLElement> = {
|
|
67
|
+
$on?: OnAttributeObject<T> | null;
|
|
68
|
+
};
|
|
69
|
+
export type BooleanAttribute = boolean;
|
|
70
|
+
export type HandlerAttributeValue = ((this: HTMLElement, event?: Event) => void);
|
|
71
|
+
export type OnHandlerObject = {
|
|
72
|
+
[key: string]: HandlerAttributeValue;
|
|
73
|
+
};
|
|
74
|
+
export type StringifiableNumber = number;
|
|
75
|
+
export type JamilihDocumentType = {
|
|
76
|
+
name: string;
|
|
77
|
+
systemId?: string;
|
|
78
|
+
publicId?: string;
|
|
79
|
+
};
|
|
80
|
+
export type DefineOptions = string | {
|
|
81
|
+
extends?: string;
|
|
82
|
+
};
|
|
83
|
+
export type DefineMixin = {
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
};
|
|
86
|
+
export type DefineConstructor = {
|
|
87
|
+
new (): HTMLElement;
|
|
88
|
+
prototype: HTMLElement;
|
|
89
|
+
};
|
|
90
|
+
export type DefineUserConstructor = (this: HTMLElement) => void;
|
|
91
|
+
export type DefineObjectArray = [DefineConstructor | DefineUserConstructor | DefineMixin, DefineOptions?] | [DefineMixin, DefineConstructor] | [DefineConstructor | DefineUserConstructor, DefineMixin?, DefineOptions?];
|
|
92
|
+
export type DefineObject = DefineObjectArray | DefineConstructor | DefineMixin | DefineUserConstructor;
|
|
93
|
+
export type SymbolObject<T = ArbitraryValue, U extends HTMLElement = HTMLElement> = T & {
|
|
94
|
+
elem?: U;
|
|
95
|
+
};
|
|
96
|
+
export type SymbolMethod<T extends HTMLElement = HTMLElement> = (this: T, ...args: UserArg[]) => UserArg;
|
|
97
|
+
export type BoundSymbolMethod = (...args: UserArg[]) => UserArg;
|
|
98
|
+
export type SymbolArray<T extends HTMLElement = HTMLElement> = [symbol | string, SymbolMethod<T> | SymbolObject<ArbitraryValue, T>];
|
|
99
|
+
export type SymbolResult = BoundSymbolMethod | SymbolObject | ArbitraryValue;
|
|
100
|
+
export type NullableAttributeValue = null | undefined;
|
|
101
|
+
export type PluginValue = [string, object] | string | object;
|
|
102
|
+
export type JamilihAttValue = (string | NullableAttributeValue | BooleanAttribute | JamilihArray | JamilihShadowRootObject | StringifiableNumber | JamilihDocumentType | JamilihDocument | XmlnsAttributeValue | OnAttributeObject | HandlerAttributeValue | DefineObject | SymbolArray | PluginReference | PluginValue);
|
|
103
|
+
export type DataAttributeObject = {
|
|
104
|
+
[key: string]: string | number | ((this: HTMLElement, ...args: UserArg[]) => UserArg);
|
|
105
|
+
};
|
|
106
|
+
export type DataAttribute = {
|
|
107
|
+
$data?: true | string[] | Map<HTMLElement, UserArg> | WeakMap<HTMLElement, UserArg> | DataAttributeObject | [undefined, DataAttributeObject] | [Map<HTMLElement, UserArg> | WeakMap<HTMLElement, UserArg> | undefined, DataAttributeObject];
|
|
108
|
+
};
|
|
109
|
+
export type DatasetAttribute = {
|
|
110
|
+
dataset?: DatasetAttributeObject;
|
|
111
|
+
};
|
|
112
|
+
export type StyleAttribute = {
|
|
113
|
+
style?: StyleAttributeValue;
|
|
114
|
+
};
|
|
115
|
+
export type JamilihShadowRootAttribute = {
|
|
116
|
+
$shadow?: JamilihShadowRootObject;
|
|
117
|
+
};
|
|
118
|
+
export type DefineAttribute = {
|
|
119
|
+
is?: string | null;
|
|
120
|
+
$define?: DefineObject;
|
|
121
|
+
};
|
|
122
|
+
export type CustomAttribute = {
|
|
123
|
+
$custom?: {
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export type SymbolAttribute = {
|
|
128
|
+
$symbol?: SymbolArray;
|
|
129
|
+
};
|
|
130
|
+
export type XmlnsAttribute = {
|
|
131
|
+
xmlns?: string | null | XmlnsAttributeObject;
|
|
132
|
+
};
|
|
133
|
+
export type JamilihAttributes = DataAttribute & StyleAttribute & JamilihShadowRootAttribute & DefineAttribute & DatasetAttribute & CustomAttribute & SymbolAttribute & OnAttribute & XmlnsAttribute & Partial<JamilihAttributeNode> & Partial<JamilihTextNode> & Partial<JamilihDoc> & Partial<JamilihDoctype> & {
|
|
134
|
+
[key: string]: JamilihAttValue | HandlerAttributeValue;
|
|
135
|
+
};
|
|
136
|
+
export type JamilihDocument = {
|
|
137
|
+
title?: string;
|
|
138
|
+
xmlDeclaration?: {
|
|
139
|
+
version: string;
|
|
140
|
+
encoding: string;
|
|
141
|
+
standalone: boolean;
|
|
142
|
+
};
|
|
143
|
+
childNodes?: JamilihChildType[];
|
|
144
|
+
$DOCTYPE?: JamilihDocumentType;
|
|
145
|
+
head?: JamilihChildren;
|
|
146
|
+
body?: JamilihChildren;
|
|
147
|
+
};
|
|
148
|
+
export type JamilihDoc = {
|
|
149
|
+
$document: JamilihDocument;
|
|
150
|
+
};
|
|
151
|
+
export type JamilihDoctype = {
|
|
152
|
+
$DOCTYPE: JamilihDocumentType;
|
|
153
|
+
};
|
|
154
|
+
export type JamilihDocumentFragmentContent = JamilihArray | TextNodeString | HTMLElement;
|
|
155
|
+
export type JamilihDocumentFragment = {
|
|
156
|
+
'#': JamilihDocumentFragmentContent[];
|
|
157
|
+
};
|
|
158
|
+
export type ElementName = string;
|
|
159
|
+
export type TextNodeString = string | number;
|
|
160
|
+
export type PluginReference = {
|
|
161
|
+
[key: string]: string;
|
|
162
|
+
};
|
|
163
|
+
export type JamilihFirstArgument = Document | ElementName | HTMLElement | DocumentFragment | JamilihDocumentFragment | JamilihDoc | JamilihDoctype | JamilihTextNode | JamilihAttributeNode;
|
|
164
|
+
export type JamilihArrayLike = (JamilihFirstArg | JamilihAttributes | JamilihArrayLike | TextNodeString | ShadowRoot | null)[];
|
|
165
|
+
export type JamilihChildren = (JamilihArray | JamilihArrayLike | TextNodeString | HTMLElement | Comment | ProcessingInstruction | Text | DocumentFragment | JamilihProcessingInstruction | JamilihDocumentFragment | PluginReference | JamilihDialectObject)[];
|
|
166
|
+
export type JamilihArray = [
|
|
167
|
+
JamilihOptions | JamilihFirstArgument | JamilihDialectObject,
|
|
168
|
+
(JamilihFirstArgument | JamilihAttributes | JamilihChildren | HTMLElement | ShadowRoot | null)?,
|
|
169
|
+
(JamilihAttributes | JamilihChildren | HTMLElement | ShadowRoot | ElementName | null)?,
|
|
170
|
+
...(JamilihAttributes | JamilihChildren | HTMLElement | ShadowRoot | ElementName | null)[]
|
|
171
|
+
];
|
|
172
|
+
export type JamilihArrayPostOptions = [
|
|
173
|
+
(string | HTMLElement | ShadowRoot),
|
|
174
|
+
(JamilihArray[] | JamilihAttributes | HTMLElement | ShadowRoot | null)?,
|
|
175
|
+
...(JamilihArray[] | HTMLElement | JamilihAttributes | ShadowRoot | null)[]
|
|
176
|
+
];
|
|
177
|
+
export type MapWithRoot = {
|
|
178
|
+
root: [Map<HTMLElement, UserArg> | WeakMap<HTMLElement, UserArg>, UserArg];
|
|
179
|
+
[key: string]: [Map<HTMLElement, UserArg> | WeakMap<HTMLElement, UserArg>, UserArg];
|
|
180
|
+
};
|
|
181
|
+
export type TraversalState = "root" | "attributeValue" | "element" | "fragment" | "children" | "fragmentChildren";
|
|
182
|
+
export type JamilihOptions = {
|
|
183
|
+
$state?: TraversalState;
|
|
184
|
+
$plugins?: JamilihPlugin[];
|
|
185
|
+
$Map?: MapWithRoot | [Map<HTMLElement, UserArg> | WeakMap<HTMLElement, UserArg>, UserArg];
|
|
186
|
+
};
|
|
187
|
+
export type ValueOf<T> = T[keyof T];
|
|
188
|
+
export type RawCustomFromJamilihArray<T extends JamilihArray> = Extract<Extract<T[number], {
|
|
189
|
+
$custom?: {
|
|
190
|
+
[key: string]: unknown;
|
|
191
|
+
};
|
|
192
|
+
}>['$custom'], object>;
|
|
193
|
+
export type SpecificDefineMixin<M> = M extends object ? string extends keyof M ? object : M : object;
|
|
194
|
+
export type DefineMixinFromValue<D> = D extends [infer First, infer Second, ...ArbitraryValue[]] ? (First extends DefineMixin ? SpecificDefineMixin<First> : Second extends DefineMixin ? SpecificDefineMixin<Second> : object) : D extends [infer First] ? First extends DefineMixin ? SpecificDefineMixin<First> : object : D extends DefineMixin ? SpecificDefineMixin<D> : object;
|
|
195
|
+
export type RawDefineMixinFromJamilihArray<T extends JamilihArray> = T[number] extends infer Item ? Item extends {
|
|
196
|
+
$define: infer D;
|
|
197
|
+
} ? DefineMixinFromValue<D> : never : never;
|
|
198
|
+
export type ElementFromDefineValue<D> = D extends [infer First, infer Second, ...ArbitraryValue[]] ? First extends DefineConstructor ? First['prototype'] : Second extends DefineConstructor ? Second['prototype'] : never : D extends DefineConstructor ? D['prototype'] : never;
|
|
199
|
+
export type ElementFromJamilihDefine<T extends JamilihArray> = T[number] extends infer Item ? Item extends {
|
|
200
|
+
$define: infer D;
|
|
201
|
+
} ? ElementFromDefineValue<D> : never : never;
|
|
202
|
+
export type HasXmlnsFromJamilihArray<T extends JamilihArray> = Extract<T[number], {
|
|
203
|
+
xmlns: unknown;
|
|
204
|
+
}> extends never ? false : true;
|
|
205
|
+
export type ElementFromJamilihArray<T extends JamilihArray> = T extends [infer K, ...ArbitraryValue[]] ? (HasXmlnsFromJamilihArray<T> extends true ? Element : ElementFromJamilihDefine<T> extends never ? K extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[K] : HTMLElement : ElementFromJamilihDefine<T>) : Element;
|
|
206
|
+
export type WithCustomThis<A, E extends Element, X> = A extends {
|
|
207
|
+
$custom: infer C;
|
|
208
|
+
} ? (C extends object ? Omit<A, '$custom'> & {
|
|
209
|
+
$custom?: C & ThisType<E & C & X>;
|
|
210
|
+
} : A) : A;
|
|
211
|
+
export type WithDefineThisValue<D, E extends Element, X> = D extends [infer First, infer Second, ...infer Rest] ? (First extends DefineMixin ? [First & ThisType<E & First & X>, Second, ...Rest] : Second extends DefineMixin ? [First, Second & ThisType<E & Second & X>, ...Rest] : D) : D extends [infer First] ? First extends DefineMixin ? [First & ThisType<E & First & X>] : D : D extends DefineMixin ? D & ThisType<E & D & X> : D;
|
|
212
|
+
export type WithDefineThis<A, E extends Element, X> = A extends {
|
|
213
|
+
$define: infer D;
|
|
214
|
+
} ? Omit<A, '$define'> & {
|
|
215
|
+
$define?: WithDefineThisValue<D, E, X>;
|
|
216
|
+
} : A;
|
|
217
|
+
export type CustomFromJamilihItem<A> = A extends {
|
|
218
|
+
$custom: infer C;
|
|
219
|
+
} ? C extends object ? C : object : object;
|
|
220
|
+
export type DefineMixinFromJamilihItem<A> = A extends {
|
|
221
|
+
$define: infer D;
|
|
222
|
+
} ? DefineMixinFromValue<D> : object;
|
|
223
|
+
export type JamilihArrayWithCustomThis<T extends JamilihArray, E extends Element> = {
|
|
224
|
+
[K in keyof T]: WithCustomThis<WithDefineThis<T[K], E, CustomFromJamilihItem<T[K]>>, E, DefineMixinFromJamilihItem<T[K]>>;
|
|
225
|
+
};
|
|
226
|
+
export type ValidateJamilihArrayLike<A> = A extends (infer Item)[] ? (Extract<Item, JamilihFirstArg> extends never ? never : A) : A;
|
|
227
|
+
export type ValidateJamilihChildContainer<A> = A extends (infer Child)[] ? A & (Child extends unknown[] ? ValidateJamilihArrayLike<Child> : Child)[] : A;
|
|
228
|
+
export type ValidateJamilihArrayLikes<T extends JamilihArray> = {
|
|
229
|
+
[K in keyof T]: ValidateJamilihChildContainer<T[K]>;
|
|
230
|
+
};
|
|
231
|
+
export type CustomFromJamilihArray<T extends JamilihArray> = (RawCustomFromJamilihArray<T> extends never ? object : RawCustomFromJamilihArray<T>);
|
|
232
|
+
export type DefineMixinFromJamilihArray<T extends JamilihArray> = (RawDefineMixinFromJamilihArray<T> extends never ? object : RawDefineMixinFromJamilihArray<T>);
|
|
233
|
+
export type ResolvedElement<U, W> = U extends void ? (ExpandoHTMLElement & W) : (U & W);
|
|
234
|
+
declare function jml<T extends JamilihArray, U extends T extends [infer K, ...ArbitraryValue[]] ? (HasXmlnsFromJamilihArray<T> extends true ? Element : ElementFromJamilihDefine<T> extends never ? K extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[K] : K extends string ? HTMLElement : void : ElementFromJamilihDefine<T>) : void, E extends ElementFromJamilihArray<T>, W extends CustomFromJamilihArray<T>, D extends DefineMixinFromJamilihArray<T>>(...args: JamilihArrayWithCustomThis<T, E> & ValidateJamilihArrayLikes<T>): U extends void ? JamilihReturn : ResolvedElement<U, W & D>;
|
|
235
|
+
declare namespace jml {
|
|
236
|
+
export { toJML };
|
|
237
|
+
export { toJMLString };
|
|
238
|
+
export { toDOM };
|
|
239
|
+
export { toHTML };
|
|
240
|
+
export { toDOMString };
|
|
241
|
+
export { toXML };
|
|
242
|
+
export { toXMLDOMString };
|
|
243
|
+
export { JamilihMap as Map };
|
|
244
|
+
export { JamilihWeakMap as WeakMap };
|
|
245
|
+
export var weak: <V>(obj: V, args_0: string | HTMLElement | ShadowRoot, args_1?: JamilihArray[] | HTMLElement | ShadowRoot | JamilihAttributes | null | undefined, ...args: (JamilihArray[] | HTMLElement | ShadowRoot | JamilihAttributes | null)[]) => MapAndElementArray<V>;
|
|
246
|
+
export var strong: <V>(obj: V, args_0: string | HTMLElement | ShadowRoot, args_1?: JamilihArray[] | HTMLElement | ShadowRoot | JamilihAttributes | null | undefined, ...args: (JamilihArray[] | HTMLElement | ShadowRoot | JamilihAttributes | null)[]) => MapAndElementArray<V>;
|
|
247
|
+
export var symbol: (element: string | HTMLElement, sym: symbol | string) => SymbolResult;
|
|
248
|
+
export var sym: (element: string | HTMLElement, sym: symbol | string) => SymbolResult;
|
|
249
|
+
export var _a: (element: string | HTMLElement, sym: symbol | string) => SymbolResult;
|
|
250
|
+
export { _a as for };
|
|
251
|
+
export var command: (elem: (string | HTMLElement) | null, symOrMap: symbol | string | Map<HTMLElement, MapCommand> | WeakMap<HTMLElement, MapCommand>, methodName: string | UserArg, ...args: UserArg[]) => StoredValue;
|
|
252
|
+
export { setWindow };
|
|
253
|
+
export { getWindow };
|
|
254
|
+
export { validateJamilih };
|
|
255
|
+
}
|
|
256
|
+
export type ToJmlConfig = {
|
|
257
|
+
/**
|
|
258
|
+
* Whether to output the Jamilih object as a string.
|
|
259
|
+
*/
|
|
260
|
+
stringOutput?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* If true (the default), will report invalid state errors
|
|
263
|
+
*/
|
|
264
|
+
reportInvalidState?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Strip whitespace for text nodes
|
|
267
|
+
*/
|
|
268
|
+
stripWhitespace?: boolean;
|
|
269
|
+
};
|
|
270
|
+
export type JamilihAttributeNodeValue = [namespace: string | null, name: string, value?: string];
|
|
271
|
+
export type JamilihAttributeNode = {
|
|
272
|
+
$attribute: JamilihAttributeNodeValue;
|
|
273
|
+
};
|
|
274
|
+
export type JamilihTextNode = {
|
|
275
|
+
$text: string;
|
|
276
|
+
};
|
|
277
|
+
export type JamilihCDATANode = ['![', string];
|
|
278
|
+
export type JamilihEntityReference = ['&', string];
|
|
279
|
+
export type JamilihProcessingInstruction = [code: '?', target: string, value: string];
|
|
280
|
+
export type JamilihComment = [code: '!', value: string];
|
|
281
|
+
export type Entity = {
|
|
282
|
+
nodeType: number;
|
|
283
|
+
nodeName: string;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Configuration object.
|
|
287
|
+
* @typedef {object} ToJmlConfig
|
|
288
|
+
* @property {boolean} [stringOutput=false] Whether to output the Jamilih object as a string.
|
|
289
|
+
* @property {boolean} [reportInvalidState=true] If true (the default), will report invalid state errors
|
|
290
|
+
* @property {boolean} [stripWhitespace=false] Strip whitespace for text nodes
|
|
291
|
+
*/
|
|
292
|
+
/**
|
|
293
|
+
* @typedef {[namespace: string|null, name: string, value?: string]} JamilihAttributeNodeValue
|
|
294
|
+
*/
|
|
295
|
+
/**
|
|
296
|
+
* @typedef {{
|
|
297
|
+
* $attribute: JamilihAttributeNodeValue
|
|
298
|
+
* }} JamilihAttributeNode
|
|
299
|
+
*/
|
|
300
|
+
/**
|
|
301
|
+
* @typedef {{
|
|
302
|
+
* $text: string
|
|
303
|
+
* }} JamilihTextNode
|
|
304
|
+
*/
|
|
305
|
+
/**
|
|
306
|
+
* @typedef {['![', string]} JamilihCDATANode
|
|
307
|
+
*/
|
|
308
|
+
/**
|
|
309
|
+
* @typedef {['&', string]} JamilihEntityReference
|
|
310
|
+
*/
|
|
311
|
+
/**
|
|
312
|
+
* @typedef {[code: '?', target: string, value: string]} JamilihProcessingInstruction
|
|
313
|
+
*/
|
|
314
|
+
/**
|
|
315
|
+
* @typedef {[code: '!', value: string]} JamilihComment
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* @typedef {{
|
|
319
|
+
* nodeType: number,
|
|
320
|
+
* nodeName: string
|
|
321
|
+
* }} Entity
|
|
322
|
+
*/
|
|
323
|
+
/**
|
|
324
|
+
* Polyfill for `DOMException`.
|
|
325
|
+
*/
|
|
326
|
+
export declare class DOMException extends Error {
|
|
327
|
+
code: number;
|
|
328
|
+
/**
|
|
329
|
+
* @param {string} message
|
|
330
|
+
* @param {string} name
|
|
331
|
+
*/
|
|
332
|
+
constructor(message: string, name: string);
|
|
333
|
+
}
|
|
334
|
+
export type JamilihChildType = JamilihArray | JamilihDoctype | JamilihCDATANode | JamilihEntityReference | JamilihProcessingInstruction | JamilihComment | JamilihDocumentFragment;
|
|
335
|
+
export type JamilihType = JamilihDoc | JamilihAttributeNode | JamilihChildType;
|
|
336
|
+
/**
|
|
337
|
+
* @typedef {JamilihArray|JamilihDoctype|
|
|
338
|
+
* JamilihCDATANode|JamilihEntityReference|JamilihProcessingInstruction|
|
|
339
|
+
* JamilihComment|JamilihDocumentFragment} JamilihChildType
|
|
340
|
+
*/
|
|
341
|
+
/**
|
|
342
|
+
* @typedef {JamilihDoc|JamilihAttributeNode|JamilihChildType} JamilihType
|
|
343
|
+
*/
|
|
344
|
+
/**
|
|
345
|
+
* Converts a DOM object or a string of HTML into a Jamilih object (or string).
|
|
346
|
+
* @param {string|HTMLElement|Node|Entity} nde If a string, will parse as document
|
|
347
|
+
* @param {ToJmlConfig} [config] Configuration object
|
|
348
|
+
* @throws {TypeError}
|
|
349
|
+
* @returns {JamilihType|string} Array containing the elements which represent
|
|
350
|
+
* a Jamilih object, or, if `stringOutput` is true, it will be the stringified
|
|
351
|
+
* version of such an object
|
|
352
|
+
*/
|
|
353
|
+
export declare const toJML: (nde: string | HTMLElement | Node | Entity, { stringOutput, reportInvalidState, stripWhitespace }?: ToJmlConfig) => JamilihType | string;
|
|
354
|
+
/**
|
|
355
|
+
* @param {string|HTMLElement} dom
|
|
356
|
+
* @param {ToJmlConfig} [config]
|
|
357
|
+
* @returns {string}
|
|
358
|
+
*/
|
|
359
|
+
export declare const toJMLString: (dom: string | HTMLElement, config?: ToJmlConfig) => string;
|
|
360
|
+
/**
|
|
361
|
+
*
|
|
362
|
+
* @param {JamilihArray} args
|
|
363
|
+
* @returns {JamilihReturn}
|
|
364
|
+
*/
|
|
365
|
+
export declare const toDOM: (...args: JamilihArray) => JamilihReturn;
|
|
366
|
+
/**
|
|
367
|
+
*
|
|
368
|
+
* @param {JamilihArray} args
|
|
369
|
+
* @returns {string}
|
|
370
|
+
*/
|
|
371
|
+
export declare const toHTML: (...args: JamilihArray) => string;
|
|
372
|
+
/**
|
|
373
|
+
*
|
|
374
|
+
* @param {JamilihArray} args
|
|
375
|
+
* @returns {string}
|
|
376
|
+
*/
|
|
377
|
+
export declare const toDOMString: (...args: JamilihArray) => string;
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* @param {JamilihArray} args
|
|
381
|
+
* @returns {string}
|
|
382
|
+
*/
|
|
383
|
+
export declare const toXML: (...args: JamilihArray) => string;
|
|
384
|
+
/**
|
|
385
|
+
*
|
|
386
|
+
* @param {JamilihArray} args
|
|
387
|
+
* @returns {string}
|
|
388
|
+
*/
|
|
389
|
+
export declare const toXMLDOMString: (...args: JamilihArray) => string;
|
|
390
|
+
/**
|
|
391
|
+
* Element-aware wrapper for `Map`.
|
|
392
|
+
* @template V
|
|
393
|
+
*/
|
|
394
|
+
declare class JamilihMap<V> extends Map {
|
|
395
|
+
/**
|
|
396
|
+
* @param {?(string|HTMLElement)} element
|
|
397
|
+
* @returns {V}
|
|
398
|
+
*/
|
|
399
|
+
get(element: (string | HTMLElement) | null): V;
|
|
400
|
+
/**
|
|
401
|
+
* @param {string|HTMLElement} element
|
|
402
|
+
* @param {V} value
|
|
403
|
+
* @returns {this}
|
|
404
|
+
*/
|
|
405
|
+
set(element: string | HTMLElement, value: V): this;
|
|
406
|
+
/**
|
|
407
|
+
* @param {string|HTMLElement} element
|
|
408
|
+
* @param {string} methodName
|
|
409
|
+
* @param {...UserArg} args
|
|
410
|
+
* @returns {StoredValue}
|
|
411
|
+
*/
|
|
412
|
+
invoke(element: string | HTMLElement, methodName: string, ...args: UserArg[]): StoredValue;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Element-aware wrapper for `WeakMap`.
|
|
416
|
+
* @template V
|
|
417
|
+
*/
|
|
418
|
+
declare class JamilihWeakMap<V> extends WeakMap {
|
|
419
|
+
/**
|
|
420
|
+
* @param {?(string|object|symbol)} element
|
|
421
|
+
* @returns {V}
|
|
422
|
+
*/
|
|
423
|
+
get(element: (string | object | symbol) | null): V;
|
|
424
|
+
/**
|
|
425
|
+
* @param {?(string|object|symbol)} element
|
|
426
|
+
* @param {V} value
|
|
427
|
+
* @returns {this}
|
|
428
|
+
*/
|
|
429
|
+
set(element: (string | object | symbol) | null, value: V): this;
|
|
430
|
+
/**
|
|
431
|
+
* @param {string|HTMLElement} element
|
|
432
|
+
* @param {string} methodName
|
|
433
|
+
* @param {...UserArg} args
|
|
434
|
+
* @returns {StoredValue}
|
|
435
|
+
*/
|
|
436
|
+
invoke(element: string | HTMLElement, methodName: string, ...args: UserArg[]): StoredValue;
|
|
437
|
+
}
|
|
438
|
+
export type MapAndElementArray<V> = [JamilihWeakMap<V> | JamilihMap<V>, HTMLElement];
|
|
439
|
+
export type MapCommand = ((elem: HTMLElement, ...args: UserArg[]) => void) | {
|
|
440
|
+
[key: string]: (elem: HTMLElement, ...args: UserArg[]) => void;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Expects properties `document`, `XMLSerializer`, and `DOMParser`.
|
|
444
|
+
* Also updates `body` with `document.body`.
|
|
445
|
+
* @param {import('jsdom').DOMWindow|HTMLWindow|typeof globalThis|undefined} wind
|
|
446
|
+
* @returns {void}
|
|
447
|
+
*/
|
|
448
|
+
export declare const setWindow: (wind: import('jsdom').DOMWindow | HTMLWindow | typeof globalThis | undefined) => void;
|
|
449
|
+
/**
|
|
450
|
+
* @returns {import('jsdom').DOMWindow|HTMLWindow|typeof globalThis}
|
|
451
|
+
*/
|
|
452
|
+
export declare const getWindow: () => import('jsdom').DOMWindow | HTMLWindow | typeof globalThis;
|
|
453
|
+
/**
|
|
454
|
+
* Does not run Jamilih so can be further processed.
|
|
455
|
+
* @template T
|
|
456
|
+
* @param {T[]} array
|
|
457
|
+
* @param {T} glu
|
|
458
|
+
* @returns {T[]}
|
|
459
|
+
*/
|
|
460
|
+
declare function glue<T>(array: T[], glu: T): T[];
|
|
461
|
+
/**
|
|
462
|
+
* @type {HTMLBodyElement}
|
|
463
|
+
*/
|
|
464
|
+
declare let body: HTMLBodyElement;
|
|
465
|
+
declare const nbsp = "\u00A0";
|
|
466
|
+
export { jml, $, $$, nbsp, body, glue, validateJamilih };
|
|
467
|
+
export { isValidJamilih } from './validateJamilih.js';
|
|
468
|
+
//# sourceMappingURL=jml.d.ts.map
|