@faqir-ui/core 1.1.2 → 1.2.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/README.md +9 -8
- package/cdn.json +40 -35
- package/dist/faqir-core.js +74 -68
- package/dist/faqir-core.min.js +3 -3
- package/dist/faqir-core.min.js.map +3 -3
- package/dist/faqir-core.mjs +134 -56
- package/dist/faqir.aurora.css +5013 -428
- package/dist/faqir.brutalist.css +5013 -428
- package/dist/faqir.candy.css +5013 -428
- package/dist/faqir.clay.css +19164 -0
- package/dist/faqir.clinical.css +5013 -428
- package/dist/faqir.contrast.css +5013 -428
- package/dist/faqir.deco.css +19247 -0
- package/dist/faqir.default.css +5013 -428
- package/dist/faqir.document-serif.css +5013 -428
- package/dist/faqir.document.css +5014 -428
- package/dist/faqir.editorial-document.css +5013 -428
- package/dist/faqir.editorial.css +5013 -428
- package/dist/faqir.fintech.css +5013 -428
- package/dist/faqir.glass.css +5013 -428
- package/dist/faqir.ink-document.css +5013 -428
- package/dist/faqir.ink.css +5013 -428
- package/dist/faqir.luxe.css +5013 -428
- package/dist/faqir.memphis.css +19163 -0
- package/dist/faqir.midnight.css +5013 -428
- package/dist/faqir.monolith.css +19162 -0
- package/dist/faqir.neo.css +5013 -428
- package/dist/faqir.neumorph.css +5013 -428
- package/dist/faqir.nordic.css +5013 -428
- package/dist/faqir.organic.css +5013 -428
- package/dist/faqir.paper.css +5013 -428
- package/dist/faqir.slate.css +5013 -428
- package/dist/faqir.soft.css +5013 -428
- package/dist/faqir.sunset.css +5013 -428
- package/dist/faqir.swiss-document.css +5013 -428
- package/dist/faqir.swiss.css +5013 -428
- package/dist/faqir.terminal.css +5013 -428
- package/dist/plugins/faqir-rules.js +1 -1
- package/dist/plugins/faqir-tweak.js +304 -0
- package/dist/plugins/faqir-validate.js +12 -4
- package/dist/sri.json +38 -33
- package/faqir-core.d.ts +42 -0
- package/package.json +1 -1
package/dist/faqir-core.mjs
CHANGED
|
@@ -361,7 +361,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
361
361
|
var children = [].slice.call(el.children);
|
|
362
362
|
for (var i = 0;i < children.length; i++) {
|
|
363
363
|
var child = children[i];
|
|
364
|
-
if (child.__faqirScope && !child.hasAttribute("l-data")) {
|
|
364
|
+
if (child.__faqirStray || child.__faqirScope && !child.hasAttribute("l-data")) {
|
|
365
365
|
continue;
|
|
366
366
|
}
|
|
367
367
|
if (child.hasAttribute("l-data")) {
|
|
@@ -1187,7 +1187,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
1187
1187
|
els[i].removeAttribute("l-cloak");
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
1190
|
-
var MOTION_PRESETS = { fade: 1, "slide-up": 1, scale: 1 };
|
|
1190
|
+
var MOTION_PRESETS = { fade: 1, "slide-up": 1, "slide-down": 1, "slide-start": 1, "slide-end": 1, scale: 1, blur: 1, flip: 1 };
|
|
1191
1191
|
function prefersReducedMotion() {
|
|
1192
1192
|
return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1193
1193
|
}
|
|
@@ -1216,7 +1216,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
var preset = el.getAttribute("l-transition") || "fade";
|
|
1218
1218
|
if (!MOTION_PRESETS[preset]) {
|
|
1219
|
-
console.warn('[Faqir] l-transition: unknown preset "' + preset + '" — expected one of:
|
|
1219
|
+
console.warn('[Faqir] l-transition: unknown preset "' + preset + '" — expected one of: ' + Object.keys(MOTION_PRESETS).join(", "));
|
|
1220
1220
|
}
|
|
1221
1221
|
el.setAttribute("data-motion", phase);
|
|
1222
1222
|
el.offsetHeight;
|
|
@@ -1285,8 +1285,8 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
1285
1285
|
el.dataset.state = value ? "on" : "off";
|
|
1286
1286
|
el.setAttribute("aria-checked", value ? "true" : "false");
|
|
1287
1287
|
});
|
|
1288
|
-
bind("
|
|
1289
|
-
writeModel(prop, el
|
|
1288
|
+
bind("click", function() {
|
|
1289
|
+
writeModel(prop, !evaluate(prop, scope, el), scope, el);
|
|
1290
1290
|
});
|
|
1291
1291
|
addCleanup(el, cl);
|
|
1292
1292
|
} else if (tag === "input" && type === "checkbox") {
|
|
@@ -4974,37 +4974,105 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
4974
4974
|
return msg.slice(data.length);
|
|
4975
4975
|
}
|
|
4976
4976
|
const ECL_MAP = { L: 0, M: 1, Q: 2, H: 3 };
|
|
4977
|
-
const
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4977
|
+
const EC_PER_BLOCK = [
|
|
4978
|
+
7,
|
|
4979
|
+
10,
|
|
4980
|
+
13,
|
|
4981
|
+
17,
|
|
4982
|
+
10,
|
|
4983
|
+
16,
|
|
4984
|
+
22,
|
|
4985
|
+
28,
|
|
4986
|
+
15,
|
|
4987
|
+
26,
|
|
4988
|
+
18,
|
|
4989
|
+
22,
|
|
4990
|
+
20,
|
|
4991
|
+
18,
|
|
4992
|
+
26,
|
|
4993
|
+
16,
|
|
4994
|
+
26,
|
|
4995
|
+
24,
|
|
4996
|
+
18,
|
|
4997
|
+
22,
|
|
4998
|
+
18,
|
|
4999
|
+
16,
|
|
5000
|
+
24,
|
|
5001
|
+
28,
|
|
5002
|
+
20,
|
|
5003
|
+
18,
|
|
5004
|
+
18,
|
|
5005
|
+
26,
|
|
5006
|
+
24,
|
|
5007
|
+
22,
|
|
5008
|
+
22,
|
|
5009
|
+
26,
|
|
5010
|
+
30,
|
|
5011
|
+
22,
|
|
5012
|
+
20,
|
|
5013
|
+
24,
|
|
5014
|
+
18,
|
|
5015
|
+
26,
|
|
5016
|
+
24,
|
|
5017
|
+
28
|
|
4989
5018
|
];
|
|
4990
|
-
const
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5019
|
+
const BLOCKS = [
|
|
5020
|
+
1,
|
|
5021
|
+
1,
|
|
5022
|
+
1,
|
|
5023
|
+
1,
|
|
5024
|
+
1,
|
|
5025
|
+
1,
|
|
5026
|
+
1,
|
|
5027
|
+
1,
|
|
5028
|
+
1,
|
|
5029
|
+
1,
|
|
5030
|
+
2,
|
|
5031
|
+
2,
|
|
5032
|
+
1,
|
|
5033
|
+
2,
|
|
5034
|
+
2,
|
|
5035
|
+
4,
|
|
5036
|
+
1,
|
|
5037
|
+
2,
|
|
5038
|
+
4,
|
|
5039
|
+
4,
|
|
5040
|
+
2,
|
|
5041
|
+
4,
|
|
5042
|
+
4,
|
|
5043
|
+
4,
|
|
5044
|
+
2,
|
|
5045
|
+
4,
|
|
5046
|
+
6,
|
|
5047
|
+
5,
|
|
5048
|
+
2,
|
|
5049
|
+
4,
|
|
5050
|
+
6,
|
|
5051
|
+
6,
|
|
5052
|
+
2,
|
|
5053
|
+
5,
|
|
5054
|
+
8,
|
|
5055
|
+
8,
|
|
5056
|
+
4,
|
|
5057
|
+
5,
|
|
5058
|
+
8,
|
|
5059
|
+
8
|
|
5002
5060
|
];
|
|
5061
|
+
const TOTAL_CODEWORDS = [26, 44, 70, 100, 134, 172, 196, 242, 292, 346];
|
|
5062
|
+
function versionInfo(version, eclIdx) {
|
|
5063
|
+
const i = (version - 1) * 4 + eclIdx;
|
|
5064
|
+
const ec = EC_PER_BLOCK[i];
|
|
5065
|
+
const b = BLOCKS[i];
|
|
5066
|
+
return { dc: TOTAL_CODEWORDS[version - 1] - ec * b, ec, b };
|
|
5067
|
+
}
|
|
5068
|
+
function alignmentPositions(v) {
|
|
5069
|
+
return v < 2 ? [] : v < 7 ? [6, 4 * v + 10] : [6, 2 * v + 8, 4 * v + 10];
|
|
5070
|
+
}
|
|
5003
5071
|
function selectVersion(dataLen, ecl) {
|
|
5004
5072
|
const eclIdx = ECL_MAP[ecl] ?? 1;
|
|
5005
5073
|
for (let v = 1;v <= 10; v++) {
|
|
5006
|
-
const info =
|
|
5007
|
-
if (dataLen <= info.dc)
|
|
5074
|
+
const info = versionInfo(v, eclIdx);
|
|
5075
|
+
if (dataLen + (v < 10 ? 2 : 3) <= info.dc)
|
|
5008
5076
|
return v;
|
|
5009
5077
|
}
|
|
5010
5078
|
return -1;
|
|
@@ -5023,16 +5091,16 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5023
5091
|
function placeFinderPattern(matrix, reserved, row, col) {
|
|
5024
5092
|
for (let r = -1;r <= 7; r++) {
|
|
5025
5093
|
for (let c = -1;c <= 7; c++) {
|
|
5026
|
-
const
|
|
5027
|
-
setModule(matrix, row + r, col + c,
|
|
5094
|
+
const d = Math.max(Math.abs(r - 3), Math.abs(c - 3));
|
|
5095
|
+
setModule(matrix, row + r, col + c, d !== 2 && d !== 4 ? 1 : 0, reserved);
|
|
5028
5096
|
}
|
|
5029
5097
|
}
|
|
5030
5098
|
}
|
|
5031
5099
|
function placeAlignmentPattern(matrix, reserved, row, col) {
|
|
5032
5100
|
for (let r = -2;r <= 2; r++) {
|
|
5033
5101
|
for (let c = -2;c <= 2; c++) {
|
|
5034
|
-
const
|
|
5035
|
-
setModule(matrix, row + r, col + c,
|
|
5102
|
+
const d = Math.max(Math.abs(r), Math.abs(c));
|
|
5103
|
+
setModule(matrix, row + r, col + c, d !== 1 ? 1 : 0, reserved);
|
|
5036
5104
|
}
|
|
5037
5105
|
}
|
|
5038
5106
|
}
|
|
@@ -5055,23 +5123,35 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5055
5123
|
setModule(reserved, 8, 8, 1);
|
|
5056
5124
|
setModule(matrix, s - 8, 8, 1, reserved);
|
|
5057
5125
|
}
|
|
5126
|
+
function placeVersionInfo(matrix, reserved, version) {
|
|
5127
|
+
if (version < 7)
|
|
5128
|
+
return;
|
|
5129
|
+
const s = matrix.length;
|
|
5130
|
+
let rem = version;
|
|
5131
|
+
for (let i = 0;i < 12; i++)
|
|
5132
|
+
rem = rem << 1 ^ (rem >> 11) * 7973;
|
|
5133
|
+
const bits = version << 12 | rem;
|
|
5134
|
+
for (let i = 0;i < 18; i++) {
|
|
5135
|
+
const bit = bits >> i & 1;
|
|
5136
|
+
const a = s - 11 + i % 3;
|
|
5137
|
+
const b = i / 3 | 0;
|
|
5138
|
+
setModule(matrix, b, a, bit, reserved);
|
|
5139
|
+
setModule(matrix, a, b, bit, reserved);
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5058
5142
|
function placeData(matrix, reserved, bits) {
|
|
5059
5143
|
const s = matrix.length;
|
|
5060
5144
|
let bitIdx = 0;
|
|
5061
|
-
let upward = true;
|
|
5062
|
-
for (let col = s - 1;col >= 1; col -= 2) {
|
|
5145
|
+
for (let col = s - 1, upward = true;col >= 1; col -= 2, upward = !upward) {
|
|
5063
5146
|
if (col === 6)
|
|
5064
5147
|
col = 5;
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
for (let
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
continue;
|
|
5071
|
-
matrix[row][cc] = bitIdx < bits.length ? bits[bitIdx++] : 0;
|
|
5148
|
+
for (let i = 0;i < s; i++) {
|
|
5149
|
+
const row = upward ? s - 1 - i : i;
|
|
5150
|
+
for (let cc = col;cc > col - 2; cc--) {
|
|
5151
|
+
if (!reserved[row][cc])
|
|
5152
|
+
matrix[row][cc] = bits[bitIdx++] | 0;
|
|
5072
5153
|
}
|
|
5073
5154
|
}
|
|
5074
|
-
upward = !upward;
|
|
5075
5155
|
}
|
|
5076
5156
|
}
|
|
5077
5157
|
function applyMask(matrix, reserved, maskId) {
|
|
@@ -5115,7 +5195,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5115
5195
|
matrix[7][8] = bit;
|
|
5116
5196
|
else
|
|
5117
5197
|
matrix[14 - i][8] = bit;
|
|
5118
|
-
if (i <
|
|
5198
|
+
if (i < 7)
|
|
5119
5199
|
matrix[s - 1 - i][8] = bit;
|
|
5120
5200
|
else
|
|
5121
5201
|
matrix[8][s - 15 + i] = bit;
|
|
@@ -5158,7 +5238,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5158
5238
|
if (version < 0)
|
|
5159
5239
|
throw new Error("Data too long for QR versions 1–10");
|
|
5160
5240
|
const eclIdx = ECL_MAP[ecl] ?? 1;
|
|
5161
|
-
const info =
|
|
5241
|
+
const info = versionInfo(version, eclIdx);
|
|
5162
5242
|
const size = version * 4 + 17;
|
|
5163
5243
|
const codewords = [];
|
|
5164
5244
|
const ccBits = version <= 9 ? 8 : 16;
|
|
@@ -5188,7 +5268,6 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5188
5268
|
}
|
|
5189
5269
|
const blocks = [];
|
|
5190
5270
|
const ecBlocks = [];
|
|
5191
|
-
const ecPerBlock = info.ec / info.b;
|
|
5192
5271
|
const dcPerBlock = Math.floor(info.dc / info.b);
|
|
5193
5272
|
const remainder = info.dc % info.b;
|
|
5194
5273
|
let offset = 0;
|
|
@@ -5197,7 +5276,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5197
5276
|
const blockData = codewords.slice(offset, offset + blockDc);
|
|
5198
5277
|
offset += blockDc;
|
|
5199
5278
|
blocks.push(blockData);
|
|
5200
|
-
ecBlocks.push(rsEncode(blockData,
|
|
5279
|
+
ecBlocks.push(rsEncode(blockData, info.ec));
|
|
5201
5280
|
}
|
|
5202
5281
|
const interleaved = [];
|
|
5203
5282
|
const maxDc = Math.max(...blocks.map((b) => b.length));
|
|
@@ -5207,11 +5286,9 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5207
5286
|
interleaved.push(block[i]);
|
|
5208
5287
|
}
|
|
5209
5288
|
}
|
|
5210
|
-
for (let i = 0;i <
|
|
5211
|
-
for (const ec of ecBlocks)
|
|
5212
|
-
|
|
5213
|
-
interleaved.push(ec[i]);
|
|
5214
|
-
}
|
|
5289
|
+
for (let i = 0;i < info.ec; i++) {
|
|
5290
|
+
for (const ec of ecBlocks)
|
|
5291
|
+
interleaved.push(ec[i]);
|
|
5215
5292
|
}
|
|
5216
5293
|
const bits = [];
|
|
5217
5294
|
interleaved.forEach((byte) => {
|
|
@@ -5223,7 +5300,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5223
5300
|
placeFinderPattern(matrix, reserved, 0, 0);
|
|
5224
5301
|
placeFinderPattern(matrix, reserved, 0, size - 7);
|
|
5225
5302
|
placeFinderPattern(matrix, reserved, size - 7, 0);
|
|
5226
|
-
const alignPos =
|
|
5303
|
+
const alignPos = alignmentPositions(version);
|
|
5227
5304
|
for (const r of alignPos) {
|
|
5228
5305
|
for (const c of alignPos) {
|
|
5229
5306
|
if (reserved[r]?.[c])
|
|
@@ -5233,6 +5310,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
5233
5310
|
}
|
|
5234
5311
|
placeTimingPatterns(matrix, reserved);
|
|
5235
5312
|
reserveFormatArea(matrix, reserved);
|
|
5313
|
+
placeVersionInfo(matrix, reserved, version);
|
|
5236
5314
|
let bestMask = 0;
|
|
5237
5315
|
let bestScore = Infinity;
|
|
5238
5316
|
for (let m = 0;m < 8; m++) {
|
|
@@ -9702,7 +9780,7 @@ var require_faqir_core = __commonJS(function(exports, module) {
|
|
|
9702
9780
|
}
|
|
9703
9781
|
}
|
|
9704
9782
|
var Faqir = {
|
|
9705
|
-
version: "1.
|
|
9783
|
+
version: "1.2.0",
|
|
9706
9784
|
reactive,
|
|
9707
9785
|
effect,
|
|
9708
9786
|
batch,
|