@lavalogic/scoria 0.40.13 → 0.40.15
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 +58 -58
- package/dist/Components/AccordionGroup.svelte +35 -46
- package/dist/Components/AccordionGroupButton.svelte +68 -76
- package/dist/Components/Action.svelte +103 -135
- package/dist/Components/AlertModal.svelte +171 -190
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
- package/dist/Components/Base/BaseModal.svelte +90 -116
- package/dist/Components/Base/ContextWrapper.svelte +67 -72
- package/dist/Components/Base/Pagination.svelte +173 -196
- package/dist/Components/Base/Snippets.svelte +34 -36
- package/dist/Components/BigRadioSet.svelte +36 -38
- package/dist/Components/Bubble.svelte +78 -101
- package/dist/Components/Button.svelte +175 -208
- package/dist/Components/Checkbox.svelte +75 -86
- package/dist/Components/CollapsibleCard.svelte +72 -87
- package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
- package/dist/Components/Contexts/ContextMenu.svelte +141 -156
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
- package/dist/Components/Contexts/Toast.svelte +81 -86
- package/dist/Components/Contexts/ToastContainer.svelte +58 -62
- package/dist/Components/Contexts/Tooltip.svelte +36 -37
- package/dist/Components/DataMatrixIcon.svelte +95 -108
- package/dist/Components/DateInput.svelte +118 -146
- package/dist/Components/DatePicker.svelte +255 -294
- package/dist/Components/DesktopModal.svelte +70 -90
- package/dist/Components/Dial.svelte +167 -197
- package/dist/Components/DimensionInput.svelte +124 -169
- package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
- package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
- package/dist/Components/FileCard.svelte +21 -24
- package/dist/Components/FileUpload.svelte +190 -225
- package/dist/Components/GridInput.svelte +159 -196
- package/dist/Components/GridInputSet.svelte +24 -29
- package/dist/Components/HorizontalTabGroup.svelte +73 -89
- package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
- package/dist/Components/Icon.svelte +99 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -38
- package/dist/Components/LoadingAnimation.svelte +691 -755
- package/dist/Components/LoadingModal.svelte +36 -44
- package/dist/Components/LoadingOverlay.svelte +22 -26
- package/dist/Components/Modal.svelte +204 -254
- package/dist/Components/MultiSelect.svelte +186 -216
- package/dist/Components/Nav/Nav.svelte +94 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
- package/dist/Components/Nav/NavTab.svelte +58 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
- package/dist/Components/Nav/ServicesNav.svelte +72 -79
- package/dist/Components/NumberInput.svelte +121 -155
- package/dist/Components/OptionCards.svelte +62 -73
- package/dist/Components/PageHeading.svelte +23 -25
- package/dist/Components/PasswordInput.svelte +69 -88
- package/dist/Components/PopoverButton.svelte +151 -0
- package/dist/Components/PopoverButton.svelte.d.ts +9 -0
- package/dist/Components/PopoverButtonProps.d.ts +21 -0
- package/dist/Components/PopoverButtonProps.js +1 -0
- package/dist/Components/Portal.svelte +29 -35
- package/dist/Components/ProgressBubble.svelte +91 -106
- package/dist/Components/QuerySelect.svelte +260 -346
- package/dist/Components/SidebarPanel.svelte +34 -36
- package/dist/Components/SingleSelect.svelte +196 -244
- package/dist/Components/StepButton.svelte +65 -70
- package/dist/Components/StepForm.svelte +115 -135
- package/dist/Components/Switch.svelte +57 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
- package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
- package/dist/Components/Table/Body/TableBody.svelte +141 -154
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
- package/dist/Components/Table/Headers/TableHead.svelte +348 -402
- package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
- package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
- package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
- package/dist/Components/Table/NestedTable.svelte +102 -128
- package/dist/Components/Table/Table.svelte +531 -663
- package/dist/Components/Test/TestContextConsumer.svelte +11 -13
- package/dist/Components/TextArea.svelte +95 -130
- package/dist/Components/TextInput.svelte +125 -176
- package/dist/Components/ThreeStateRadio.svelte +111 -130
- package/dist/Components/Touch/BoolCard.svelte +33 -45
- package/dist/Components/Touch/DateModal.svelte +164 -204
- package/dist/Components/Touch/EditCard.svelte +48 -59
- package/dist/Components/Touch/InfoCard.svelte +28 -31
- package/dist/Components/Touch/InfoTextCard.svelte +26 -28
- package/dist/Components/Touch/ModalExplanation.svelte +15 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
- package/dist/Components/Touch/NumberModal.svelte +59 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
- package/dist/Components/Touch/SelectModal.svelte +111 -126
- package/dist/Components/Touch/SummaryCard.svelte +80 -93
- package/dist/Components/Touch/TextAreaModal.svelte +72 -94
- package/dist/Components/Touch/TextModal.svelte +77 -105
- package/dist/Components/Touch/TouchCard.svelte +31 -33
- package/dist/Components/Touch/TouchModal.svelte +214 -270
- package/dist/Components/Touch/UtilityButton.svelte +88 -109
- package/dist/Components/VerticalTabGroup.svelte +60 -78
- package/dist/Components/VerticalTabGroupButton.svelte +54 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +31 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3392 -3392
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +1 -1
|
@@ -1,67 +1,63 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<!--
|
|
4
|
-
@component
|
|
5
|
-
Live region for the {@link ToastContext}. Iterates the context's
|
|
6
|
-
queue and renders one `Toast` per message, providing the
|
|
7
|
-
copy-to-clipboard callback (the container owns the clipboard logic
|
|
8
|
-
because the toast itself only knows the message it should copy).
|
|
9
|
-
|
|
10
|
-
The wrapping `<section>` carries `role="region"` plus
|
|
11
|
-
`aria-live="polite"` so multiple toast appearances are announced as
|
|
12
|
-
a single rolling region without interrupting the user; individual
|
|
13
|
-
`Toast` elements override `aria-live` to `assertive` for hard errors.
|
|
14
|
-
|
|
15
|
-
Mounted once at the app root by `ContextWrapper`; consumers should
|
|
16
|
-
not render this directly.
|
|
17
|
-
-->
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// the runtime check is the load-bearing one.
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
33
|
-
if (!navigator.clipboard) {
|
|
34
|
-
toastContext.toast({
|
|
35
|
-
result: Validity.Invalid,
|
|
36
|
-
message: 'Cannot Copy in an Insecure Connection',
|
|
37
|
-
copyable: false,
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
navigator.clipboard.writeText(text).catch(devCatch);
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
@component
|
|
5
|
+
Live region for the {@link ToastContext}. Iterates the context's
|
|
6
|
+
queue and renders one `Toast` per message, providing the
|
|
7
|
+
copy-to-clipboard callback (the container owns the clipboard logic
|
|
8
|
+
because the toast itself only knows the message it should copy).
|
|
9
|
+
|
|
10
|
+
The wrapping `<section>` carries `role="region"` plus
|
|
11
|
+
`aria-live="polite"` so multiple toast appearances are announced as
|
|
12
|
+
a single rolling region without interrupting the user; individual
|
|
13
|
+
`Toast` elements override `aria-live` to `assertive` for hard errors.
|
|
14
|
+
|
|
15
|
+
Mounted once at the app root by `ContextWrapper`; consumers should
|
|
16
|
+
not render this directly.
|
|
17
|
+
-->
|
|
18
|
+
<script lang="ts">import { ToastContext } from "../../Contexts/ToastContext.svelte.js";
|
|
19
|
+
import { devCatch } from "../../Helpers/Helpers.svelte.js";
|
|
20
|
+
import { Validity } from "../../Types/Internal/Validity.js";
|
|
21
|
+
import { getContext } from "svelte";
|
|
22
|
+
import Toast from "./Toast.svelte";
|
|
23
|
+
const toastContext = getContext(ToastContext.identifier);
|
|
24
|
+
function copyDataToClipboard(text) {
|
|
25
|
+
// `navigator.clipboard` is `undefined` on insecure (HTTP)
|
|
26
|
+
// origins and in some embedded WebViews. The compile-time
|
|
27
|
+
// type says it is always defined, hence the eslint disable;
|
|
28
|
+
// the runtime check is the load-bearing one.
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
30
|
+
if (!navigator.clipboard) {
|
|
43
31
|
toastContext.toast({
|
|
44
|
-
result: Validity.
|
|
45
|
-
message:
|
|
46
|
-
copyable: false
|
|
32
|
+
result: Validity.Invalid,
|
|
33
|
+
message: "Cannot Copy in an Insecure Connection",
|
|
34
|
+
copyable: false
|
|
47
35
|
});
|
|
36
|
+
return;
|
|
48
37
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
38
|
+
navigator.clipboard.writeText(text).catch(devCatch);
|
|
39
|
+
toastContext.toast({
|
|
40
|
+
result: Validity.Info,
|
|
41
|
+
message: "Message copied to clipboard",
|
|
42
|
+
copyable: false
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<section
|
|
48
|
+
aria-live="polite"
|
|
49
|
+
aria-label="Notifications"
|
|
50
|
+
>
|
|
51
|
+
{#each toastContext.toasts as toast (toast.id)}
|
|
52
|
+
<Toast
|
|
53
|
+
{toast}
|
|
54
|
+
copy={() => {
|
|
55
|
+
copyDataToClipboard(toast.getVerbose?.() ?? toast.message);
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
{/each}
|
|
59
|
+
</section>
|
|
60
|
+
|
|
65
61
|
<style>section {
|
|
66
62
|
user-select: none;
|
|
67
63
|
gap: 0.5rem;
|
|
@@ -73,4 +69,4 @@ not render this directly.
|
|
|
73
69
|
justify-content: flex-end;
|
|
74
70
|
align-items: flex-end;
|
|
75
71
|
z-index: 99999;
|
|
76
|
-
}</style>
|
|
72
|
+
}</style>
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<!--
|
|
4
|
-
@component
|
|
5
|
-
Visual host for `TooltipContext`. Renders a fixed-position tooltip at
|
|
6
|
-
the coordinates the context exposes, with a CSS arrow that points
|
|
7
|
-
back toward the anchored element on the configured side.
|
|
8
|
-
|
|
9
|
-
The tooltip just appears and disappears; no transition is applied,
|
|
10
|
-
which is the conservative choice for `prefers-reduced-motion`. Reads
|
|
11
|
-
the context with `getContext` and relies on `ContextWrapper` to have
|
|
12
|
-
set it up at the app root.
|
|
13
|
-
-->
|
|
14
|
-
<script lang="ts">
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class=
|
|
26
|
-
class:
|
|
27
|
-
class:
|
|
28
|
-
class:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
@component
|
|
5
|
+
Visual host for `TooltipContext`. Renders a fixed-position tooltip at
|
|
6
|
+
the coordinates the context exposes, with a CSS arrow that points
|
|
7
|
+
back toward the anchored element on the configured side.
|
|
8
|
+
|
|
9
|
+
The tooltip just appears and disappears; no transition is applied,
|
|
10
|
+
which is the conservative choice for `prefers-reduced-motion`. Reads
|
|
11
|
+
the context with `getContext` and relies on `ContextWrapper` to have
|
|
12
|
+
set it up at the app root.
|
|
13
|
+
-->
|
|
14
|
+
<script lang="ts">import { TooltipContext } from "../../Contexts/TooltipContext.svelte.js";
|
|
15
|
+
import { Side } from "../../Types/Internal/Side.js";
|
|
16
|
+
import { getContext } from "svelte";
|
|
17
|
+
const tooltipContext = getContext(TooltipContext.identifier);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#if tooltipContext.isShowingTooltip}
|
|
21
|
+
<div
|
|
22
|
+
role="tooltip"
|
|
23
|
+
style="--y: {tooltipContext.y}px; --x: {tooltipContext.x}px;"
|
|
24
|
+
class="tooltip-wrapper"
|
|
25
|
+
class:top-arrow={tooltipContext.anchor === Side.Top}
|
|
26
|
+
class:bottom-arrow={tooltipContext.anchor === Side.Bottom}
|
|
27
|
+
class:left-arrow={tooltipContext.anchor === Side.Left}
|
|
28
|
+
class:right-arrow={tooltipContext.anchor === Side.Right}
|
|
29
|
+
>
|
|
30
|
+
<div class="tooltip">
|
|
31
|
+
{tooltipContext.text}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
35
|
+
|
|
37
36
|
<style>.tooltip-wrapper {
|
|
38
37
|
position: fixed;
|
|
39
38
|
z-index: 99999;
|
|
@@ -123,4 +122,4 @@ set it up at the app root.
|
|
|
123
122
|
transform: rotate(45deg);
|
|
124
123
|
background-color: #3a4952;
|
|
125
124
|
border: solid 2px #dae0e5;
|
|
126
|
-
}</style>
|
|
125
|
+
}</style>
|
|
@@ -1,114 +1,101 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* neutralises stored-XSS sinks (`<script>`, `<image href="javascript:...">`,
|
|
32
|
-
* inline event handlers) without depending on caller discipline.
|
|
33
|
-
*/
|
|
34
|
-
function sanitiseSvg(node: SVGSVGElement): void {
|
|
35
|
-
node.querySelectorAll('script').forEach((s) => {
|
|
36
|
-
s.remove();
|
|
37
|
-
});
|
|
38
|
-
node.querySelectorAll('*').forEach((el) => {
|
|
39
|
-
for (const attr of [...el.attributes]) {
|
|
40
|
-
const lower = attr.name.toLowerCase();
|
|
41
|
-
if (lower.startsWith('on') || lower === 'href' || lower === 'xlink:href') {
|
|
42
|
-
el.removeAttribute(attr.name);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
$effect(() => {
|
|
49
|
-
if (icon.kind !== 'svg') {
|
|
50
|
-
// icon-props branch renders an <Icon> below; nothing for the
|
|
51
|
-
// SVG mount effect to do, and we clear the stale mount so a
|
|
52
|
-
// later toggle back to kind: 'svg' re-mounts correctly.
|
|
53
|
-
if (svgContainer != null && lastSvg !== undefined) {
|
|
54
|
-
// Mirror of the mount path below; `replaceChildren()` is the
|
|
55
|
-
// cheapest way to detach the previously cloned SVG.
|
|
56
|
-
// eslint-disable-next-line svelte/no-dom-manipulating
|
|
57
|
-
svgContainer.replaceChildren();
|
|
58
|
-
lastSvg = undefined;
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">import { passthrough } from "../Helpers/Helpers.svelte.js";
|
|
4
|
+
import Icon from "./Icon.svelte";
|
|
5
|
+
const { icon, interactive = false, title, oncontextmenu, ariaLabel = "Edit Barcode Value" } = $props();
|
|
6
|
+
let svgContainer = $state(null);
|
|
7
|
+
// Track the last SVG we mounted so the effect only re-runs when the
|
|
8
|
+
// underlying SVG identity changes. Repeated parent renders that hand
|
|
9
|
+
// back the same node should NOT force a DOM replacement; each replace
|
|
10
|
+
// forces layout, which becomes expensive with many barcodes on a screen.
|
|
11
|
+
let lastSvg = undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Defensively sanitise the SVG before mounting it.
|
|
14
|
+
*
|
|
15
|
+
* SECURITY: although the prop is branded `DataMatrixSvg` to discourage
|
|
16
|
+
* arbitrary callers, the brand is type-only. As defence in depth we
|
|
17
|
+
* strip `<script>` nodes plus any `on*` / `href` / `xlink:href`
|
|
18
|
+
* attributes from the cloned tree before it enters the document. This
|
|
19
|
+
* neutralises stored-XSS sinks (`<script>`, `<image href="javascript:...">`,
|
|
20
|
+
* inline event handlers) without depending on caller discipline.
|
|
21
|
+
*/
|
|
22
|
+
function sanitiseSvg(node) {
|
|
23
|
+
node.querySelectorAll("script").forEach((s) => {
|
|
24
|
+
s.remove();
|
|
25
|
+
});
|
|
26
|
+
node.querySelectorAll("*").forEach((el) => {
|
|
27
|
+
for (const attr of [...el.attributes]) {
|
|
28
|
+
const lower = attr.name.toLowerCase();
|
|
29
|
+
if (lower.startsWith("on") || lower === "href" || lower === "xlink:href") {
|
|
30
|
+
el.removeAttribute(attr.name);
|
|
59
31
|
}
|
|
60
|
-
return;
|
|
61
32
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
// it skips the HTML parse step and only touches the child list.
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
$effect(() => {
|
|
36
|
+
if (icon.kind !== "svg") {
|
|
37
|
+
// icon-props branch renders an <Icon> below; nothing for the
|
|
38
|
+
// SVG mount effect to do, and we clear the stale mount so a
|
|
39
|
+
// later toggle back to kind: 'svg' re-mounts correctly.
|
|
40
|
+
if (svgContainer != null && lastSvg !== undefined) {
|
|
41
|
+
// Mirror of the mount path below; `replaceChildren()` is the
|
|
42
|
+
// cheapest way to detach the previously cloned SVG.
|
|
73
43
|
// eslint-disable-next-line svelte/no-dom-manipulating
|
|
74
|
-
svgContainer.replaceChildren(
|
|
75
|
-
lastSvg =
|
|
44
|
+
svgContainer.replaceChildren();
|
|
45
|
+
lastSvg = undefined;
|
|
76
46
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const source = icon.svg;
|
|
50
|
+
if (svgContainer != null && source !== lastSvg) {
|
|
51
|
+
// Clone so we never mutate the consumer-supplied node. If the
|
|
52
|
+
// same SVG is rendered into multiple DataMatrixIcon instances or
|
|
53
|
+
// reused elsewhere the original keeps its original attributes.
|
|
54
|
+
const local = source.cloneNode(true);
|
|
55
|
+
sanitiseSvg(local);
|
|
56
|
+
local.setAttribute("width", "64");
|
|
57
|
+
local.setAttribute("height", "64");
|
|
58
|
+
// `replaceChildren` is cheaper than `innerHTML = ''` + `appendChild`:
|
|
59
|
+
// it skips the HTML parse step and only touches the child list.
|
|
60
|
+
// eslint-disable-next-line svelte/no-dom-manipulating
|
|
61
|
+
svgContainer.replaceChildren(local);
|
|
62
|
+
lastSvg = source;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
{#if interactive}
|
|
68
|
+
<button
|
|
69
|
+
aria-label={ariaLabel}
|
|
70
|
+
onkeydown={passthrough}
|
|
71
|
+
title="Right click to edit barcode value for the {title} command"
|
|
72
|
+
oncontextmenu={(e) => {
|
|
73
|
+
if (oncontextmenu) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
oncontextmenu(e);
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
class="fit"
|
|
81
|
+
bind:this={svgContainer}
|
|
82
|
+
>
|
|
83
|
+
{#if icon.kind === 'icon-props'}
|
|
84
|
+
<Icon {...icon.iconProps} />
|
|
85
|
+
{/if}
|
|
86
|
+
</div>
|
|
87
|
+
</button>
|
|
88
|
+
{:else}
|
|
89
|
+
<div
|
|
90
|
+
class="fit"
|
|
91
|
+
bind:this={svgContainer}
|
|
92
|
+
>
|
|
93
|
+
{#if icon.kind === 'icon-props'}
|
|
94
|
+
<Icon {...icon.iconProps} />
|
|
95
|
+
{/if}
|
|
96
|
+
</div>
|
|
97
|
+
{/if}
|
|
98
|
+
|
|
112
99
|
<style>button {
|
|
113
100
|
display: contents;
|
|
114
101
|
cursor: pointer;
|
|
@@ -118,4 +105,4 @@ div.fit {
|
|
|
118
105
|
background-color: #ffffff;
|
|
119
106
|
display: flex;
|
|
120
107
|
padding: 0.5rem;
|
|
121
|
-
}</style>
|
|
108
|
+
}</style>
|