@joewinke/jatui 0.1.31 → 0.1.33

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.
@@ -8,9 +8,9 @@
8
8
  * routing via the `urlGenerator` parameter or by setting a default.
9
9
  */
10
10
  // Regex to match mention pattern: [@Display Name](type:id)
11
- const MENTION_REGEX = /\[@([^\]]+)\]\(([^:]+):([^)]+)\)/g;
11
+ var MENTION_REGEX = /\[@([^\]]+)\]\(([^:]+):([^)]+)\)/g;
12
12
  // Default URL generator (apps can override)
13
- let defaultUrlGenerator = (type, id) => `#${type}/${id}`;
13
+ var defaultUrlGenerator = function (type, id) { return "#".concat(type, "/").concat(id); };
14
14
  /**
15
15
  * Set the default URL generator for mentions.
16
16
  * Call this once at app startup to configure mention link routing.
@@ -22,20 +22,20 @@ export function setMentionUrlGenerator(generator) {
22
22
  * Parse message content and extract all mentions
23
23
  */
24
24
  export function parseMentions(content, urlGenerator) {
25
- const mentions = [];
26
- const gen = urlGenerator ?? defaultUrlGenerator;
27
- let match;
25
+ var mentions = [];
26
+ var gen = urlGenerator !== null && urlGenerator !== void 0 ? urlGenerator : defaultUrlGenerator;
27
+ var match;
28
28
  MENTION_REGEX.lastIndex = 0;
29
29
  while ((match = MENTION_REGEX.exec(content)) !== null) {
30
- const [fullMatch, displayName, type, id] = match;
30
+ var fullMatch = match[0], displayName = match[1], type = match[2], id = match[3];
31
31
  mentions.push({
32
- type,
33
- id,
34
- displayName,
32
+ type: type,
33
+ id: id,
34
+ displayName: displayName,
35
35
  url: gen(type, id),
36
36
  startIndex: match.index,
37
37
  endIndex: match.index + fullMatch.length,
38
- fullMatch
38
+ fullMatch: fullMatch
39
39
  });
40
40
  }
41
41
  return mentions;
@@ -44,15 +44,15 @@ export function parseMentions(content, urlGenerator) {
44
44
  * Convert message content with mentions to HTML
45
45
  */
46
46
  export function renderMentionsAsHTML(content, urlGenerator) {
47
- const mentions = parseMentions(content, urlGenerator);
47
+ var mentions = parseMentions(content, urlGenerator);
48
48
  if (mentions.length === 0) {
49
49
  return escapeHTML(content);
50
50
  }
51
- let result = '';
52
- let lastIndex = 0;
53
- mentions.forEach((mention) => {
51
+ var result = '';
52
+ var lastIndex = 0;
53
+ mentions.forEach(function (mention) {
54
54
  result += escapeHTML(content.substring(lastIndex, mention.startIndex));
55
- result += `<a href="${mention.url}" class="mention-link mention-${mention.type}" data-mention-type="${mention.type}" data-mention-id="${mention.id}">@${escapeHTML(mention.displayName)}</a>`;
55
+ result += "<a href=\"".concat(mention.url, "\" class=\"mention-link mention-").concat(mention.type, "\" data-mention-type=\"").concat(mention.type, "\" data-mention-id=\"").concat(mention.id, "\">@").concat(escapeHTML(mention.displayName), "</a>");
56
56
  lastIndex = mention.endIndex;
57
57
  });
58
58
  result += escapeHTML(content.substring(lastIndex));
@@ -62,7 +62,7 @@ export function renderMentionsAsHTML(content, urlGenerator) {
62
62
  * Create a mention string for insertion into message input
63
63
  */
64
64
  export function createMentionString(type, id, displayName) {
65
- return `[@${displayName}](${type}:${id})`;
65
+ return "[@".concat(displayName, "](").concat(type, ":").concat(id, ")");
66
66
  }
67
67
  /**
68
68
  * Extract plain text from message content (remove mention markup)
@@ -75,18 +75,18 @@ export function extractPlainText(content) {
75
75
  * Check if cursor is inside a mention
76
76
  */
77
77
  export function findMentionAtCursor(content, cursorPosition) {
78
- const mentions = parseMentions(content);
79
- return (mentions.find((mention) => cursorPosition >= mention.startIndex && cursorPosition <= mention.endIndex) || null);
78
+ var mentions = parseMentions(content);
79
+ return (mentions.find(function (mention) { return cursorPosition >= mention.startIndex && cursorPosition <= mention.endIndex; }) || null);
80
80
  }
81
81
  /**
82
82
  * Find @ symbol and following text that could be a mention being typed.
83
83
  * Supported symbols: @ $ # ! ~ / +
84
84
  */
85
85
  export function findPartialMention(content, cursorPosition) {
86
- const mentionSymbols = ['@', '$', '#', '!', '~', '/', '+'];
87
- let symbolIndex = -1;
88
- for (let i = cursorPosition - 1; i >= 0; i--) {
89
- const char = content[i];
86
+ var mentionSymbols = ['@', '$', '#', '!', '~', '/', '+'];
87
+ var symbolIndex = -1;
88
+ for (var i = cursorPosition - 1; i >= 0; i--) {
89
+ var char = content[i];
90
90
  if (mentionSymbols.includes(char)) {
91
91
  symbolIndex = i;
92
92
  break;
@@ -97,21 +97,21 @@ export function findPartialMention(content, cursorPosition) {
97
97
  }
98
98
  if (symbolIndex === -1)
99
99
  return null;
100
- const query = content.substring(symbolIndex + 1, cursorPosition).trim();
101
- const existingMention = findMentionAtCursor(content, symbolIndex);
100
+ var query = content.substring(symbolIndex + 1, cursorPosition).trim();
101
+ var existingMention = findMentionAtCursor(content, symbolIndex);
102
102
  if (existingMention)
103
103
  return null;
104
- return { start: symbolIndex, query };
104
+ return { start: symbolIndex, query: query };
105
105
  }
106
106
  /**
107
107
  * Replace partial mention with complete mention string
108
108
  */
109
109
  export function replaceMentionInContent(content, startIndex, endIndex, mentionString) {
110
- const before = content.substring(0, startIndex);
111
- const after = content.substring(endIndex);
112
- const newContent = before + mentionString + after;
113
- const newCursorPosition = startIndex + mentionString.length;
114
- return { newContent, newCursorPosition };
110
+ var before = content.substring(0, startIndex);
111
+ var after = content.substring(endIndex);
112
+ var newContent = before + mentionString + after;
113
+ var newCursorPosition = startIndex + mentionString.length;
114
+ return { newContent: newContent, newCursorPosition: newCursorPosition };
115
115
  }
116
116
  /**
117
117
  * Simple HTML escape function
@@ -1,31 +1,34 @@
1
1
  import { parsePhoneNumberFromString, getCountries, getCountryCallingCode, } from "libphonenumber-js";
2
- export const DEFAULT_COUNTRY = "US";
3
- export function toE164(raw, defaultCountry = DEFAULT_COUNTRY) {
2
+ export var DEFAULT_COUNTRY = "US";
3
+ export function toE164(raw, defaultCountry) {
4
+ if (defaultCountry === void 0) { defaultCountry = DEFAULT_COUNTRY; }
4
5
  if (!raw)
5
6
  return null;
6
- const trimmed = raw.trim();
7
+ var trimmed = raw.trim();
7
8
  if (!trimmed)
8
9
  return null;
9
- const parsed = parsePhoneNumberFromString(trimmed, defaultCountry);
10
- if (parsed?.isValid())
10
+ var parsed = parsePhoneNumberFromString(trimmed, defaultCountry);
11
+ if (parsed === null || parsed === void 0 ? void 0 : parsed.isValid())
11
12
  return parsed.number;
12
13
  return null;
13
14
  }
14
15
  export function formatPhoneForDisplay(e164) {
15
16
  if (!e164)
16
17
  return "";
17
- const parsed = parsePhoneNumberFromString(e164);
18
+ var parsed = parsePhoneNumberFromString(e164);
18
19
  if (!parsed)
19
20
  return e164;
20
21
  return parsed.country === DEFAULT_COUNTRY ? parsed.formatNational() : parsed.formatInternational();
21
22
  }
22
- export function isValidPhone(raw, defaultCountry = DEFAULT_COUNTRY) {
23
+ export function isValidPhone(raw, defaultCountry) {
24
+ var _a;
25
+ if (defaultCountry === void 0) { defaultCountry = DEFAULT_COUNTRY; }
23
26
  if (!raw)
24
27
  return false;
25
- const parsed = parsePhoneNumberFromString(raw.trim(), defaultCountry);
26
- return parsed?.isValid() ?? false;
28
+ var parsed = parsePhoneNumberFromString(raw.trim(), defaultCountry);
29
+ return (_a = parsed === null || parsed === void 0 ? void 0 : parsed.isValid()) !== null && _a !== void 0 ? _a : false;
27
30
  }
28
- const COUNTRY_NAMES = {
31
+ var COUNTRY_NAMES = {
29
32
  US: "United States", CA: "Canada", GB: "United Kingdom", AU: "Australia", NZ: "New Zealand",
30
33
  IE: "Ireland", DE: "Germany", FR: "France", ES: "Spain", IT: "Italy", NL: "Netherlands",
31
34
  BE: "Belgium", CH: "Switzerland", AT: "Austria", SE: "Sweden", NO: "Norway", DK: "Denmark",
@@ -40,22 +43,25 @@ function flagEmoji(code) {
40
43
  return code
41
44
  .toUpperCase()
42
45
  .split("")
43
- .map((c) => String.fromCodePoint(127397 + c.charCodeAt(0)))
46
+ .map(function (c) { return String.fromCodePoint(127397 + c.charCodeAt(0)); })
44
47
  .join("");
45
48
  }
46
- let countriesCache = null;
49
+ var countriesCache = null;
47
50
  export function listCountries() {
48
51
  if (countriesCache)
49
52
  return countriesCache;
50
- const all = getCountries()
51
- .map((code) => ({
52
- code,
53
- name: COUNTRY_NAMES[code] ?? code,
54
- dialCode: `+${getCountryCallingCode(code)}`,
55
- flag: flagEmoji(code),
56
- }))
57
- .sort((a, b) => a.name.localeCompare(b.name));
53
+ var all = getCountries()
54
+ .map(function (code) {
55
+ var _a;
56
+ return ({
57
+ code: code,
58
+ name: (_a = COUNTRY_NAMES[code]) !== null && _a !== void 0 ? _a : code,
59
+ dialCode: "+".concat(getCountryCallingCode(code)),
60
+ flag: flagEmoji(code),
61
+ });
62
+ })
63
+ .sort(function (a, b) { return a.name.localeCompare(b.name); });
58
64
  countriesCache = all;
59
65
  return all;
60
66
  }
61
- export const PRIORITY_COUNTRIES = ["US", "CA", "GB", "AU", "MX"];
67
+ export var PRIORITY_COUNTRIES = ["US", "CA", "GB", "AU", "MX"];
@@ -14,19 +14,19 @@ export function stripPhoneNumber(value) {
14
14
  * Formats a phone number to (xxx) xxx-xxxx format
15
15
  */
16
16
  export function formatPhoneNumber(value) {
17
- const digits = stripPhoneNumber(value);
18
- const limitedDigits = digits.slice(0, 10);
17
+ var digits = stripPhoneNumber(value);
18
+ var limitedDigits = digits.slice(0, 10);
19
19
  if (limitedDigits.length === 0) {
20
20
  return '';
21
21
  }
22
22
  else if (limitedDigits.length <= 3) {
23
- return `(${limitedDigits}`;
23
+ return "(".concat(limitedDigits);
24
24
  }
25
25
  else if (limitedDigits.length <= 6) {
26
- return `(${limitedDigits.slice(0, 3)}) ${limitedDigits.slice(3)}`;
26
+ return "(".concat(limitedDigits.slice(0, 3), ") ").concat(limitedDigits.slice(3));
27
27
  }
28
28
  else {
29
- return `(${limitedDigits.slice(0, 3)}) ${limitedDigits.slice(3, 6)}-${limitedDigits.slice(6)}`;
29
+ return "(".concat(limitedDigits.slice(0, 3), ") ").concat(limitedDigits.slice(3, 6), "-").concat(limitedDigits.slice(6));
30
30
  }
31
31
  }
32
32
  /**
@@ -45,11 +45,11 @@ export function isValidPhoneNumber(value) {
45
45
  * Handles input formatting with cursor position preservation
46
46
  */
47
47
  export function updatePhoneInput(input, newValue, oldValue) {
48
- const cursorPosition = input.selectionStart || 0;
49
- const oldLength = oldValue.length;
50
- const newLength = newValue.length;
48
+ var cursorPosition = input.selectionStart || 0;
49
+ var oldLength = oldValue.length;
50
+ var newLength = newValue.length;
51
51
  input.value = newValue;
52
- let newCursorPosition = cursorPosition;
52
+ var newCursorPosition = cursorPosition;
53
53
  if (newLength > oldLength) {
54
54
  newCursorPosition = cursorPosition + (newLength - oldLength);
55
55
  }
@@ -67,5 +67,5 @@ export function typeIcon(type) {
67
67
  * "in_progress" → "In Progress"
68
68
  */
69
69
  export function statusLabel(status) {
70
- return status.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
70
+ return status.replace(/_/g, ' ').replace(/\b\w/g, function (c) { return c.toUpperCase(); });
71
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",
@@ -12,6 +12,11 @@
12
12
  "svelte": "./dist/index.js",
13
13
  "default": "./dist/index.js"
14
14
  },
15
+ "./dnd": {
16
+ "types": "./dist/dnd/index.d.ts",
17
+ "svelte": "./dist/dnd/index.js",
18
+ "default": "./dist/dnd/index.js"
19
+ },
15
20
  "./styles/rail.css": "./dist/styles/rail.css"
16
21
  },
17
22
  "files": [
@@ -64,7 +69,7 @@
64
69
  }
65
70
  },
66
71
  "devDependencies": {
67
- "@atlaskit/pragmatic-drag-and-drop": "~2.0.1",
72
+ "@atlaskit/pragmatic-drag-and-drop": "~2.0.0",
68
73
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "~3.0.0",
69
74
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "~2.0.0",
70
75
  "@atlaskit/pragmatic-drag-and-drop-live-region": "~2.0.0",