@pacem/pacem-ui 1.1.0-sierpinski → 2.0.0-abel
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/browser/pacem-ui.js +14 -183
- package/dist/browser/pacem-ui.js.map +1 -1
- package/dist/browser/pacem-ui.min.js +2 -2
- package/dist/bundle/pacem-ui.min.mjs +75 -75
- package/dist/bundle/pacem-ui.mjs +11 -239
- package/dist/bundle/pacem-ui.mjs.map +3 -3
- package/dist/docs/pacem-ui.json +1 -16
- package/dist/esm/adapter.js +1 -1
- package/dist/esm/anchor.js +1 -1
- package/dist/esm/balloon.js +1 -1
- package/dist/esm/binder.js +1 -1
- package/dist/esm/blade.js +1 -1
- package/dist/esm/bottom-sheet.js +1 -1
- package/dist/esm/button.js +1 -1
- package/dist/esm/buttonset.js +1 -1
- package/dist/esm/calendar.js +1 -1
- package/dist/esm/collapse.js +1 -1
- package/dist/esm/dialog-abstractions.js +1 -1
- package/dist/esm/dialog.js +1 -1
- package/dist/esm/divider.js +1 -1
- package/dist/esm/icon.js +1 -1
- package/dist/esm/image.js +1 -1
- package/dist/esm/index-components-ui.js +1 -1
- package/dist/esm/index-components.js +1 -1
- package/dist/esm/index-iife.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/infinite-scroller.js +1 -1
- package/dist/esm/iterative.js +1 -1
- package/dist/esm/lightbox-abstractions.js +1 -1
- package/dist/esm/lightbox.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/markdown-svc.js +14 -183
- package/dist/esm/markdown.js +1 -1
- package/dist/esm/marquee.js +1 -1
- package/dist/esm/media-query.js +1 -1
- package/dist/esm/menu.js +1 -1
- package/dist/esm/pager.js +1 -1
- package/dist/esm/picture.js +1 -1
- package/dist/esm/progressbar.js +1 -1
- package/dist/esm/sidebar.js +1 -1
- package/dist/esm/slideshow.js +1 -1
- package/dist/esm/social-twitter.js +1 -1
- package/dist/esm/sticky-header.js +1 -1
- package/dist/esm/tabs.js +1 -1
- package/dist/esm/ticker.js +1 -1
- package/dist/esm/toast.js +1 -1
- package/dist/esm/toc.js +1 -1
- package/dist/esm/tuner.js +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/vibration.js +1 -1
- package/dist/esm/view.js +1 -1
- package/dist/esm/window.js +1 -1
- package/package.json +1 -1
- package/typings/index.d.ts +5 -2
package/dist/browser/pacem-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem-ui
|
|
2
|
+
* @pacem/pacem-ui v2.0.0-abel (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -3989,156 +3989,6 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
3989
3989
|
], PacemLoaderElement);
|
|
3990
3990
|
|
|
3991
3991
|
//namespace Pacem {
|
|
3992
|
-
const match = (input, pattern, fn) => {
|
|
3993
|
-
const arr = pattern.exec(input);
|
|
3994
|
-
if (arr && arr.length) {
|
|
3995
|
-
return fn(arr);
|
|
3996
|
-
}
|
|
3997
|
-
return null;
|
|
3998
|
-
};
|
|
3999
|
-
const MARKUP_RULES = [
|
|
4000
|
-
{
|
|
4001
|
-
// comment
|
|
4002
|
-
exec: (input) => match(input, /^((<|<)!--(?:(?!(--(>|>)))[\s\S])*(--(?:>|>)|$))/, arr => {
|
|
4003
|
-
const raw = arr[0], text = raw;
|
|
4004
|
-
return [{
|
|
4005
|
-
type: 'code-comment', raw, text, index: arr.index
|
|
4006
|
-
}];
|
|
4007
|
-
})
|
|
4008
|
-
},
|
|
4009
|
-
{
|
|
4010
|
-
// opening/self-closing tag
|
|
4011
|
-
exec: (input, lexer) => match(input, /^(<|<)([\w-]+)(?:\s+[\w-]+(?:=(?:'[^']*'|"[^"]*"))*)*(\s*\/?(?:>|>))/, arr => {
|
|
4012
|
-
const openingTag = arr[1], tagName = arr[2], closingTag = arr[3];
|
|
4013
|
-
const closingTagIndex = arr[0].length - closingTag.length, attributesIndex = openingTag.length + tagName.length, attributesString = input.substring(attributesIndex, closingTagIndex);
|
|
4014
|
-
const attributes = lexer.tokenize(attributesString, [{
|
|
4015
|
-
exec: (input) => match(input, /^(\s+[\w-]+)(=('[^']*'|"[^"]*"))?/, arr => {
|
|
4016
|
-
const raw = arr[1];
|
|
4017
|
-
const output = [{
|
|
4018
|
-
type: 'code-attribute', raw, text: raw, index: arr[0].indexOf(raw)
|
|
4019
|
-
}];
|
|
4020
|
-
if (arr.length > 2) {
|
|
4021
|
-
output.push({
|
|
4022
|
-
type: 'code-string', raw: arr[2], text: arr[2], index: arr.index + arr[0].length - arr[2].length
|
|
4023
|
-
});
|
|
4024
|
-
}
|
|
4025
|
-
return output;
|
|
4026
|
-
})
|
|
4027
|
-
}]);
|
|
4028
|
-
const retval = [{
|
|
4029
|
-
type: 'code-tag', raw: openingTag, text: openingTag, index: 0
|
|
4030
|
-
}, {
|
|
4031
|
-
type: 'code-tagname', raw: tagName, text: tagName, index: openingTag.length
|
|
4032
|
-
}];
|
|
4033
|
-
// attributes
|
|
4034
|
-
Array.prototype.push.apply(retval, attributes);
|
|
4035
|
-
retval.push({
|
|
4036
|
-
type: 'code-tag', raw: closingTag, text: closingTag, index: closingTagIndex
|
|
4037
|
-
});
|
|
4038
|
-
return retval;
|
|
4039
|
-
})
|
|
4040
|
-
},
|
|
4041
|
-
{
|
|
4042
|
-
// closing tag
|
|
4043
|
-
exec: (input) => match(input, /^((?:<|<)\/)([\w-]+)(\s*(?:>|>))/, arr => {
|
|
4044
|
-
const openingTag = arr[1], tagName = arr[2], closingTag = arr[3];
|
|
4045
|
-
return [{
|
|
4046
|
-
type: 'code-tag', raw: openingTag, text: openingTag, index: 0
|
|
4047
|
-
}, {
|
|
4048
|
-
type: 'code-tagname', raw: tagName, text: tagName, index: openingTag.length
|
|
4049
|
-
}, {
|
|
4050
|
-
type: 'code-tag', raw: closingTag, text: closingTag, index: arr.index + arr[0].length - closingTag.length
|
|
4051
|
-
}];
|
|
4052
|
-
})
|
|
4053
|
-
},
|
|
4054
|
-
{
|
|
4055
|
-
// text
|
|
4056
|
-
exec: (input) => match(input, /^(<|<)?((?!<|<).)+/, arr => {
|
|
4057
|
-
const raw = arr[0], text = raw;
|
|
4058
|
-
return [{
|
|
4059
|
-
type: 'text', raw, text
|
|
4060
|
-
}];
|
|
4061
|
-
})
|
|
4062
|
-
}
|
|
4063
|
-
];
|
|
4064
|
-
const C_LIKE_RULES = [{
|
|
4065
|
-
// comments
|
|
4066
|
-
exec: (input, _) => match(input, /^\/\/.*/, arr => {
|
|
4067
|
-
const raw = arr[0], text = raw;
|
|
4068
|
-
return [{
|
|
4069
|
-
type: 'code-comment', raw, text
|
|
4070
|
-
}];
|
|
4071
|
-
})
|
|
4072
|
-
}, {
|
|
4073
|
-
exec: (input, _) => match(input, /^\/\*(?:(?!(\*\/))[\s\S])*(?:\*\/|$)/, arr => {
|
|
4074
|
-
const raw = arr[0], text = raw;
|
|
4075
|
-
return [{
|
|
4076
|
-
type: 'code-comment', raw, text
|
|
4077
|
-
}];
|
|
4078
|
-
})
|
|
4079
|
-
}, {
|
|
4080
|
-
// string literal
|
|
4081
|
-
exec: (input, _) => match(input, /^('(\\'|[^'])*[^\\]?'|@?\$?"(\\"|[^"])*[^\\]?")/, arr => {
|
|
4082
|
-
const raw = arr[0], text = raw;
|
|
4083
|
-
return [{
|
|
4084
|
-
type: 'code-string', raw, text
|
|
4085
|
-
}];
|
|
4086
|
-
})
|
|
4087
|
-
}, {
|
|
4088
|
-
// keywords
|
|
4089
|
-
exec: (input, _) => match(input, /^\b(abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|static|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|nameof|orderby|partial|remove|select|set|value|var|when|where|yield)\b/, arr => {
|
|
4090
|
-
const raw = arr[0], text = raw;
|
|
4091
|
-
return [{
|
|
4092
|
-
type: 'code-keyword', raw, text
|
|
4093
|
-
}];
|
|
4094
|
-
})
|
|
4095
|
-
}, {
|
|
4096
|
-
// number
|
|
4097
|
-
exec: (input, _) => match(input, /^\b((0x[0-9a-fA-F]|[\d])*\.?[\d]+)\b/, arr => {
|
|
4098
|
-
const raw = arr[0], text = raw;
|
|
4099
|
-
return [{
|
|
4100
|
-
type: 'code-number', raw, text
|
|
4101
|
-
}];
|
|
4102
|
-
})
|
|
4103
|
-
}, {
|
|
4104
|
-
// variables, operators, parentheses
|
|
4105
|
-
exec: (input, _) => match(input, /^(@?\w+|:|\?\??|\?=?|\|\|?|&&?|&=?|;|,|=|\*=?|--|-=?|\+\+|\+=?|\/=?|\^|\(|\[|\)|\]|\{|\})/, arr => {
|
|
4106
|
-
const raw = arr[0], text = raw;
|
|
4107
|
-
return [{
|
|
4108
|
-
type: 'text', raw, text
|
|
4109
|
-
}];
|
|
4110
|
-
}),
|
|
4111
|
-
}, {
|
|
4112
|
-
// spaces
|
|
4113
|
-
exec: (input, _) => match(input, /^\s+/, arr => {
|
|
4114
|
-
const raw = arr[0], text = raw;
|
|
4115
|
-
return [{
|
|
4116
|
-
type: 'space', raw, text
|
|
4117
|
-
}];
|
|
4118
|
-
}),
|
|
4119
|
-
}];
|
|
4120
|
-
const SCRIPT_RULES = [
|
|
4121
|
-
C_LIKE_RULES[0], C_LIKE_RULES[1], {
|
|
4122
|
-
// string literal
|
|
4123
|
-
exec: (input, _) => match(input, /^('(\\'|[^'])*[^\\]?'|"(\\"|[^"])*[^\\]?"|`(\\`|[^`])*[^\\]?`)/, arr => {
|
|
4124
|
-
const raw = arr[0], text = raw;
|
|
4125
|
-
return [{
|
|
4126
|
-
type: 'code-string', raw, text
|
|
4127
|
-
}];
|
|
4128
|
-
})
|
|
4129
|
-
}, {
|
|
4130
|
-
// keywords
|
|
4131
|
-
exec: (input, _) => match(input, /^\b(abstract|any|arguments|async|await|boolean|break|byte|case|catch|char|class|const|continue|debugger|declare|default|delete|do|double|else|enum|eval|export|extends|false|final|finally|float|for|function|get|goto|if|implements|import|in|instanceof|int|interface|let|long|native|new|null|number|package|private|protected|public|return|short|static|string|super|switch|synchronized|this|throw|throws|transient|true|try|type|typeof|var|void|volatile|while|with|yield)\b/, arr => {
|
|
4132
|
-
const raw = arr[0], text = raw;
|
|
4133
|
-
return [{
|
|
4134
|
-
type: 'code-keyword', raw, text
|
|
4135
|
-
}];
|
|
4136
|
-
})
|
|
4137
|
-
},
|
|
4138
|
-
C_LIKE_RULES[4],
|
|
4139
|
-
C_LIKE_RULES[5],
|
|
4140
|
-
C_LIKE_RULES[6]
|
|
4141
|
-
];
|
|
4142
3992
|
const TWITTER_RULE = {
|
|
4143
3993
|
rule: {
|
|
4144
3994
|
exec: (input) => {
|
|
@@ -4177,39 +4027,18 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
4177
4027
|
case 'tweet':
|
|
4178
4028
|
return `<!-- twitter embed -->
|
|
4179
4029
|
<${pacemCore.P}-tweetembed tweetid="${token.text}"></${pacemCore.P}-tweetembed>`;
|
|
4180
|
-
// code
|
|
4181
|
-
case 'code-string':
|
|
4182
|
-
case 'code-keyword':
|
|
4183
|
-
case 'code-number':
|
|
4184
|
-
case 'code-comment':
|
|
4185
|
-
case 'code-tag':
|
|
4186
|
-
case 'code-tagname':
|
|
4187
|
-
case 'code-attribute':
|
|
4188
|
-
return `<span class="${token.type}">${token.text}</span>`;
|
|
4189
4030
|
}
|
|
4190
4031
|
};
|
|
4191
|
-
/**
|
|
4032
|
+
/**
|
|
4033
|
+
* Parses Markdown into HTML, extended with Pacem-specific inline embeds (`{tweet}(id)`, `{yt}(id)`).
|
|
4034
|
+
* Fenced code blocks are highlighted by the language-agnostic `Compile.Scanner`, for every language registered in
|
|
4035
|
+
* `Compile.Syntaxes` (built-in: javascript/typescript, html/xml, c#, c/c++, json; more can be registered at runtime).
|
|
4036
|
+
*/
|
|
4192
4037
|
class MarkdownService {
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
];
|
|
4198
|
-
for (let lang of ['c-sharp', 'c', 'c#', 'csharp', 'c++', 'cpp']) {
|
|
4199
|
-
const c_like_rules = C_LIKE_RULES.map(rule => { return { rule, lang, type: 'code' }; });
|
|
4200
|
-
Array.prototype.push.apply(grammar, c_like_rules);
|
|
4201
|
-
}
|
|
4202
|
-
for (let lang of ['ts', 'js', 'typescript', 'javascript']) {
|
|
4203
|
-
const script_rules = SCRIPT_RULES.map(rule => { return { rule, lang, type: 'code' }; });
|
|
4204
|
-
Array.prototype.push.apply(grammar, script_rules);
|
|
4205
|
-
}
|
|
4206
|
-
for (let lang of ['xml', 'html']) {
|
|
4207
|
-
const markup_rules = MARKUP_RULES.map(rule => { return { rule, lang, type: 'code' }; });
|
|
4208
|
-
Array.prototype.push.apply(grammar, markup_rules);
|
|
4209
|
-
}
|
|
4210
|
-
this.#grammar = grammar;
|
|
4211
|
-
}
|
|
4212
|
-
#grammar;
|
|
4038
|
+
#grammar = [
|
|
4039
|
+
TWITTER_RULE,
|
|
4040
|
+
YOUTUBE_RULE
|
|
4041
|
+
];
|
|
4213
4042
|
#md = new pacemFoundation.Compile.Markdown.Parser();
|
|
4214
4043
|
_escape(md) {
|
|
4215
4044
|
// no html allowed
|
|
@@ -4217,11 +4046,13 @@ css-class="{{ ['hour-start-'+ (^item.hour + 1), 'hour-end-'+ (^item.hour + ^item
|
|
|
4217
4046
|
}
|
|
4218
4047
|
/** Converts the given Markdown source into an HTML string. */
|
|
4219
4048
|
toHtml(md) {
|
|
4220
|
-
|
|
4049
|
+
const escaped = this._escape(md);
|
|
4050
|
+
return this.#md.toHtml(escaped, this.#grammar, RULES_TO_HTML);
|
|
4221
4051
|
}
|
|
4222
4052
|
/** Tokenizes the given Markdown source, without rendering it to HTML. */
|
|
4223
4053
|
tokenize(md) {
|
|
4224
|
-
|
|
4054
|
+
const escaped = this._escape(md);
|
|
4055
|
+
return this.#md.tokenize(escaped, this.#grammar);
|
|
4225
4056
|
}
|
|
4226
4057
|
}
|
|
4227
4058
|
|